50 lines
1.8 KiB
Bash
50 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|||
|
|
# Stage 10 — install everything available from the official repositories.
|
||
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||
|
|
|
||
|
|
log "Installing official packages"
|
||
|
|
|
||
|
|
require_arch
|
||
|
|
require_not_root
|
||
|
|
require_sudo
|
||
|
|
|
||
|
|
mapfile -t PKGS < <(read_pkg_list "$PACKAGES_DIR/pacman.txt")
|
||
|
|
[[ ${#PKGS[@]} -gt 0 ]] || die "pacman.txt yielded no packages"
|
||
|
|
|
||
|
|
# Split into "already installed" and "to install" so re-runs are quiet.
|
||
|
|
TO_INSTALL=()
|
||
|
|
for p in "${PKGS[@]}"; do
|
||
|
|
if pacman -Qq "$p" >/dev/null 2>&1; then
|
||
|
|
continue
|
||
|
|
fi
|
||
|
|
TO_INSTALL+=("$p")
|
||
|
|
done
|
||
|
|
|
||
|
|
if [[ ${#TO_INSTALL[@]} -eq 0 ]]; then
|
||
|
|
ok "all ${#PKGS[@]} packages already installed"
|
||
|
|
else
|
||
|
|
step "installing ${#TO_INSTALL[@]} of ${#PKGS[@]} packages"
|
||
|
|
printf '%s %s%s\n' "$C_DIM" "${TO_INSTALL[*]}" "$C_RESET"
|
||
|
|
# --needed keeps reinstalls off the table; failures on a single package
|
||
|
|
# should not nuke the whole run, so retry one-by-one if the batch fails.
|
||
|
|
if ! run sudo pacman -S --needed --noconfirm "${TO_INSTALL[@]}"; then
|
||
|
|
warn "batch install failed — retrying package by package"
|
||
|
|
for p in "${TO_INSTALL[@]}"; do
|
||
|
|
run sudo pacman -S --needed --noconfirm "$p" || warn "could not install: $p"
|
||
|
|
done
|
||
|
|
fi
|
||
|
|
fi
|
||
|
|
|
||
|
|
# --- GPU driver hint -------------------------------------------------------
|
||
|
|
if lspci 2>/dev/null | grep -qi 'vga.*intel'; then
|
||
|
|
step "Intel GPU detected — installing vulkan-intel"
|
||
|
|
run sudo pacman -S --needed --noconfirm vulkan-intel intel-media-driver || true
|
||
|
|
elif lspci 2>/dev/null | grep -qi 'vga.*amd\|vga.*ati'; then
|
||
|
|
step "AMD GPU detected — installing vulkan-radeon"
|
||
|
|
run sudo pacman -S --needed --noconfirm vulkan-radeon libva-mesa-driver || true
|
||
|
|
elif lspci 2>/dev/null | grep -qi 'vga.*nvidia'; then
|
||
|
|
warn "NVIDIA GPU detected — install 'nvidia' or 'nvidia-open' yourself; see README"
|
||
|
|
fi
|
||
|
|
|
||
|
|
ok "official packages done"
|