Add pacstall for neovim install + version updates on debian
Three changes: 1. NEW run_once_05-install-pacstall.sh.tmpl (debian-only) Installs pacstall via its official installer. Pacstall is an AUR-like package manager for debian/ubuntu, with neovim at 0.12.2-1 (current as of bootstrap). The installer requires root and prompts for 'install axel?', so we run it under sudo with NON_INTERACTIVE=true and stdin redirected from /dev/null. 2. UPDATE run_once_20-install-user-packages.sh.tmpl On debian, prefer pacstall over the GitHub tarball when pacstall is available. The tarball fallback remains for the case where pacstall install failed or isn't wanted. 3. NEW dot_config/topgrade/topgrade.toml Topgrade's built-in pacstall step auto-detects pacstall and runs 'pacstall -U -Up' (update repo + upgrade packages). Built-in chezmoi step also auto-detects chezmoi. So our topgrade config just sets pre_sudo=true for password caching and ignore_failures for node.
This commit is contained in:
parent
6771aff6a6
commit
b4a4b6e6b4
3 changed files with 116 additions and 32 deletions
17
dot_config/topgrade/topgrade.toml
Normal file
17
dot_config/topgrade/topgrade.toml
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
# =============================================================================
|
||||||
|
# topgrade.toml — chezmoi-managed
|
||||||
|
# Most steps (system, pacstall, flatpak, snap, cargo, npm, pyenv, rustup, etc.)
|
||||||
|
# are auto-detected by topgrade when their binaries are on $PATH. Only set
|
||||||
|
# custom config here.
|
||||||
|
# =============================================================================
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
# Run `sudo -v` at the start so cached credentials cover the whole run.
|
||||||
|
# Without this, topgrade will pause for password mid-run on each sudo invocation.
|
||||||
|
pre_sudo = true
|
||||||
|
|
||||||
|
# Don't fail the whole run if one step fails.
|
||||||
|
ignore_failures = ["node"]
|
||||||
|
|
||||||
|
# Print the time in step titles for verbose output.
|
||||||
|
display_time = true
|
||||||
58
run_once_05-install-pacstall.sh.tmpl
Normal file
58
run_once_05-install-pacstall.sh.tmpl
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# =============================================================================
|
||||||
|
# run_once_05-install-pacstall.sh.tmpl (debian-only)
|
||||||
|
# Install pacstall: AUR-like package manager for debian/ubuntu.
|
||||||
|
# Reference: https://pacstall.dev
|
||||||
|
#
|
||||||
|
# Steps:
|
||||||
|
# 1. Install pacstall's apt dependencies via apt
|
||||||
|
# 2. Run pacstall's official installer (must be root, hence sudo)
|
||||||
|
#
|
||||||
|
# Body wrapped in os_family guard: no-op on arch (already has AUR + chaotic).
|
||||||
|
# =============================================================================
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
log() { printf '\033[1;34m[pacstall]\033[0m %s\n' "$*"; }
|
||||||
|
die() { printf '\033[1;31m[pacstall ERROR]\033[0m %s\n' "$*" >&2; exit 1; }
|
||||||
|
|
||||||
|
# This script runs as the invoking user; sudo handles elevation.
|
||||||
|
|
||||||
|
{{ if eq .os_family "debian" -}}
|
||||||
|
# Skip if pacstall is already installed
|
||||||
|
if command -v pacstall >/dev/null 2>&1; then
|
||||||
|
log "pacstall already installed: $(pacstall -V 2>/dev/null || echo unknown)"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install pacstall's apt deps first (idempotent — pacstall will skip if present)
|
||||||
|
log "installing pacstall apt dependencies"
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y --no-install-recommends \
|
||||||
|
sudo wget build-essential unzip git zstd iputils-ping \
|
||||||
|
aptitude bubblewrap jq distro-info-data spdx-licenses \
|
||||||
|
gettext curl ca-certificates
|
||||||
|
|
||||||
|
# Fetch and run pacstall's official installer.
|
||||||
|
# It must be invoked as root (sudo). NON_INTERACTIVE=true + </dev/null so it
|
||||||
|
# doesn't prompt for the "install axel?" question.
|
||||||
|
log "downloading pacstall installer"
|
||||||
|
PACSTALL_INSTALLER="$(mktemp /tmp/pacstall-install.XXXXXX.sh)"
|
||||||
|
if ! curl -fL --retry 3 https://pacstall.dev/q/install -o "$PACSTALL_INSTALLER"; then
|
||||||
|
die "failed to download pacstall installer"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "running pacstall installer (this installs ~20 scripts to /usr/share/pacstall)"
|
||||||
|
sudo NON_INTERACTIVE=true bash "$PACSTALL_INSTALLER" </dev/null
|
||||||
|
rm -f "$PACSTALL_INSTALLER"
|
||||||
|
|
||||||
|
if ! command -v pacstall >/dev/null 2>&1; then
|
||||||
|
die "pacstall installer ran but pacstall not on PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "pacstall installed: $(pacstall -V 2>/dev/null || echo unknown)"
|
||||||
|
|
||||||
|
{{ else -}}
|
||||||
|
# Not a debian-base box — nothing to do.
|
||||||
|
log "skipping pacstall install (os_family={{ .os_family }}, not debian)"
|
||||||
|
|
||||||
|
{{ end -}}
|
||||||
|
|
@ -62,19 +62,28 @@ if command -v fdfind >/dev/null 2>&1 && ! command -v fd >/dev/null 2>&1; then
|
||||||
ln -sf "$(command -v fdfind)" "$USER_HOME/.local/bin/fd"
|
ln -sf "$(command -v fdfind)" "$USER_HOME/.local/bin/fd"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Neovim — always install the latest official binary tarball on debian.
|
# Neovim — install via pacstall on debian (auto-updated by topgrade via
|
||||||
# apt's neovim is too old for LazyVim on stable (bookworm), and even on
|
# built-in pacstall step). Falls back to GitHub tarball if pacstall isn't
|
||||||
# trixie we want a known-good version. Detect arch for the right tarball.
|
# available for some reason.
|
||||||
ARCH="$(uname -m)"
|
if command -v pacstall >/dev/null 2>&1; then
|
||||||
case "$ARCH" in
|
if ! command -v nvim >/dev/null 2>&1; then
|
||||||
|
log "installing neovim via pacstall"
|
||||||
|
sudo pacstall -I neovim
|
||||||
|
else
|
||||||
|
log "neovim already installed: $(nvim --version | head -1)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "pacstall not installed — falling back to GitHub tarball"
|
||||||
|
ARCH="$(uname -m)"
|
||||||
|
case "$ARCH" in
|
||||||
x86_64) NVIM_TARBALL="nvim-linux64.tar.gz" ;;
|
x86_64) NVIM_TARBALL="nvim-linux64.tar.gz" ;;
|
||||||
aarch64|arm64) NVIM_TARBALL="nvim-linux-arm64.tar.gz" ;;
|
aarch64|arm64) NVIM_TARBALL="nvim-linux-arm64.tar.gz" ;;
|
||||||
*)
|
*)
|
||||||
die "unsupported arch for neovim tarball: $ARCH"
|
die "unsupported arch for neovim tarball: $ARCH"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if command -v nvim >/dev/null 2>&1; then
|
if command -v nvim >/dev/null 2>&1; then
|
||||||
NVIM_VER="$(nvim --version | head -1 | awk '{print $2}' | tr -d 'v')"
|
NVIM_VER="$(nvim --version | head -1 | awk '{print $2}' | tr -d 'v')"
|
||||||
NVIM_MAJOR="$(echo "$NVIM_VER" | cut -d. -f1)"
|
NVIM_MAJOR="$(echo "$NVIM_VER" | cut -d. -f1)"
|
||||||
NVIM_MINOR="$(echo "$NVIM_VER" | cut -d. -f2)"
|
NVIM_MINOR="$(echo "$NVIM_VER" | cut -d. -f2)"
|
||||||
|
|
@ -85,18 +94,18 @@ if command -v nvim >/dev/null 2>&1; then
|
||||||
log "neovim $NVIM_VER from apt is recent enough — keeping it"
|
log "neovim $NVIM_VER from apt is recent enough — keeping it"
|
||||||
NVIM_TARBALL=""
|
NVIM_TARBALL=""
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$NVIM_TARBALL" ]]; then
|
if [[ -n "$NVIM_TARBALL" ]]; then
|
||||||
log "downloading neovim from GitHub ($NVIM_TARBALL)"
|
log "downloading neovim from GitHub ($NVIM_TARBALL)"
|
||||||
cd /tmp
|
cd /tmp
|
||||||
NVIM_LATEST="$(curl -fsSL https://api.github.com/repos/neovim/neovim/releases/latest | grep tag_name | cut -d'"' -f4)"
|
NVIM_LATEST="$(curl -fsSL https://api.github.com/repos/neovim/neovim/releases/latest | grep tag_name | cut -d'"' -f4)"
|
||||||
curl -fL "https://github.com/neovim/neovim/releases/download/${NVIM_LATEST}/${NVIM_TARBALL}" -o nvim.tar.gz
|
curl -fL "https://github.com/neovim/neovim/releases/download/${NVIM_LATEST}/${NVIM_TARBALL}" -o nvim.tar.gz
|
||||||
sudo rm -rf /opt/nvim-linux* /usr/local/bin/nvim
|
sudo rm -rf /opt/nvim-linux* /usr/local/bin/nvim
|
||||||
sudo tar -xzf nvim.tar.gz -C /opt/
|
sudo tar -xzf nvim.tar.gz -C /opt/
|
||||||
# The arm64 tarball extracts to nvim-linux-arm64, x86_64 to nvim-linux64.
|
|
||||||
sudo ln -sf "/opt/$(basename nvim.tar.gz .tar.gz)/bin/nvim" /usr/local/bin/nvim
|
sudo ln -sf "/opt/$(basename nvim.tar.gz .tar.gz)/bin/nvim" /usr/local/bin/nvim
|
||||||
rm -f nvim.tar.gz
|
rm -f nvim.tar.gz
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify neovim is reachable (PATH may need /usr/local/bin explicitly for this run)
|
# Verify neovim is reachable (PATH may need /usr/local/bin explicitly for this run)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue