1
0
Fork 0
gnu-plus-dotfiles/run_once_05-install-pacstall.sh.tmpl
rain b4a4b6e6b4 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.
2026-06-21 20:43:38 -04:00

58 lines
No EOL
2.2 KiB
Bash

#!/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 -}}