62 lines
No EOL
2.1 KiB
Bash
Executable file
62 lines
No EOL
2.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# =============================================================================
|
|
# run_once_10-add-chaotic-aur.sh.tmpl (arch-only)
|
|
# Add Chaotic-AUR repo + keyring to pacman, then install paru from there.
|
|
# Reference: https://aur.chaotic.cx/docs
|
|
#
|
|
# Steps from chaotic docs:
|
|
# 1. Get and sign the key
|
|
# 2. Install chaotic-keyring + chaotic-mirrorlist
|
|
# 3. Append repo to /etc/pacman.conf
|
|
#
|
|
# Body is wrapped in an os_family conditional: this script is a no-op on
|
|
# debian (or anything non-arch).
|
|
# =============================================================================
|
|
set -euo pipefail
|
|
|
|
log() { printf '\033[1;34m[chaotic]\033[0m %s\n' "$*"; }
|
|
die() { printf '\033[1;31m[chaotic ERROR]\033[0m %s\n' "$*" >&2; exit 1; }
|
|
|
|
# This script runs as the invoking user; sudo handles elevation for pacman
|
|
# and pacman-key operations below.
|
|
|
|
{{ if eq .os_family "arch" -}}
|
|
if command -v paru >/dev/null 2>&1 && sudo grep -q "^\[chaotic-aur\]" /etc/pacman.conf; then
|
|
log "chaotic-aur + paru already set up — skipping"
|
|
exit 0
|
|
fi
|
|
|
|
# Chaotic's official bootstrap.
|
|
log "fetching chaotic key (3056513887B78AEB)"
|
|
sudo pacman-key --recv-key 3056513887B78AEB
|
|
sudo pacman-key --lsign-key 3056513887B78AEB
|
|
|
|
log "installing chaotic-keyring and chaotic-mirrorlist"
|
|
sudo pacman -U --noconfirm \
|
|
'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-keyring.pkg.tar.zst' \
|
|
'https://cdn-mirror.chaotic.cx/chaotic-aur/chaotic-mirrorlist.pkg.tar.zst'
|
|
|
|
# Append chaotic repo to pacman.conf if not already present
|
|
if ! sudo grep -q "^\[chaotic-aur\]" /etc/pacman.conf; then
|
|
log "appending chaotic-aur to /etc/pacman.conf"
|
|
sudo tee -a /etc/pacman.conf >/dev/null <<'PACMAN_EOF'
|
|
|
|
[chaotic-aur]
|
|
Include = /etc/pacman.d/chaotic-mirrorlist
|
|
PACMAN_EOF
|
|
else
|
|
log "chaotic-aur already in /etc/pacman.conf"
|
|
fi
|
|
|
|
log "full system sync with chaotic enabled"
|
|
sudo pacman -Syu --noconfirm
|
|
|
|
log "installing paru from chaotic-aur"
|
|
sudo pacman -S --needed --noconfirm paru
|
|
|
|
log "chaotic-aur + paru ready"
|
|
paru --version
|
|
{{ else -}}
|
|
# Not an arch-base box — nothing to do.
|
|
log "skipping chaotic-aur setup (os_family={{ .os_family }}, not arch)"
|
|
{{ end -}} |