Files
arch-i3/scripts/20-aur.sh
T

52 lines
1.6 KiB
Bash
Raw Normal View History

2026-09-14 15:31:20 -05:00
#!/usr/bin/env bash
# Stage 20 — bootstrap the yay AUR helper and install AUR packages.
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
log "AUR packages"
require_arch
require_not_root
require_sudo
# --- yay -------------------------------------------------------------------
if have yay; then
ok "yay already installed"
else
step "building yay-bin from the AUR"
build_dir="$(mktemp -d)"
if [[ "$DRY_RUN" == "1" ]]; then
skip "would clone + makepkg yay-bin in $build_dir"
else
git clone --depth 1 https://aur.archlinux.org/yay-bin.git "$build_dir/yay-bin"
( cd "$build_dir/yay-bin" && makepkg -si --noconfirm )
rm -rf "$build_dir"
fi
ok "yay installed"
fi
# --- i3lock -> i3lock-color swap ------------------------------------------
# betterlockscreen needs i3lock-color; it conflicts with plain i3lock.
if pacman -Qq i3lock >/dev/null 2>&1 && ! pacman -Qq i3lock-color >/dev/null 2>&1; then
step "removing repo i3lock so i3lock-color can take over"
run sudo pacman -Rdd --noconfirm i3lock || warn "could not remove i3lock; yay will prompt about the conflict"
fi
mapfile -t AUR_PKGS < <(read_pkg_list "$PACKAGES_DIR/aur.txt")
TO_INSTALL=()
for p in "${AUR_PKGS[@]}"; do
pacman -Qq "$p" >/dev/null 2>&1 || TO_INSTALL+=("$p")
done
if [[ ${#TO_INSTALL[@]} -eq 0 ]]; then
ok "all AUR packages already installed"
else
step "installing: ${TO_INSTALL[*]}"
for p in "${TO_INSTALL[@]}"; do
run yay -S --needed --noconfirm --answerclean None --answerdiff None "$p" \
|| warn "AUR package failed to build: $p (continuing)"
done
fi
ok "AUR stage done"