1
0
Fork 0
gnu-plus-dotfiles/run_once_05-install-pacstall.sh.tmpl
rain 3d972bd144 run_once_05: stop pre-installing pacstall deps, let installer handle them
The pacstall installer has its own dep install logic that handles edge
cases (e.g. debian-trixie dropped spdx-licenses from apt, so the
installer has a fallback to fetch the .deb directly from
ftp.debian.org and install via 'apt install /path/to/deb'). My script
was duplicating that logic with a strict apt-get install that failed
because spdx-licenses isn't in trixie apt.

Fix: install only the absolute minimum (curl, wget, ca-certificates,
sudo) so the installer can fetch and verify its own deps. Trust the
installer.
2026-06-21 20:58:00 -04:00

65 lines
No EOL
2.6 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
# Update apt cache (installer needs it)
sudo apt-get update -y
# Make sure we have the tools the pacstall installer needs to fetch and
# verify its own dependencies. It handles the rest itself.
log "ensuring pacstall installer prerequisites"
sudo apt-get install -y --no-install-recommends \
curl wget ca-certificates sudo
# 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.
# The installer installs its own apt dependencies (sudo, wget, build-essential,
# unzip, git, zstd, iputils-ping, aptitude, bubblewrap, jq, distro-info-data,
# spdx-licenses, gettext, curl, ca-certificates, optionally axel). For packages
# not in the host's apt repos (e.g. spdx-licenses on debian trixie), the
# installer has a built-in fallback that downloads the .deb directly from
# ftp.debian.org and installs it with apt install.
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 -}}