initial commit
This commit is contained in:
Executable
+50
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stage 00 — sanity checks, mirror refresh, pacman quality-of-life.
|
||||
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
||||
|
||||
log "Preflight"
|
||||
|
||||
require_arch
|
||||
require_not_root
|
||||
require_sudo
|
||||
|
||||
step "checking network connectivity"
|
||||
if ! ping -c1 -W3 archlinux.org >/dev/null 2>&1; then
|
||||
warn "cannot reach archlinux.org — package installation will fail"
|
||||
confirm "continue anyway?" || die "aborted"
|
||||
else
|
||||
ok "network reachable"
|
||||
fi
|
||||
|
||||
# --- pacman.conf niceties --------------------------------------------------
|
||||
step "enabling pacman colour output + parallel downloads"
|
||||
if [[ "$DRY_RUN" != "1" ]]; then
|
||||
sudo sed -i \
|
||||
-e 's/^#\(Color\)$/\1/' \
|
||||
-e 's/^#\(VerbosePkgLists\)$/\1/' \
|
||||
-e 's/^#\?ParallelDownloads.*/ParallelDownloads = 8/' \
|
||||
/etc/pacman.conf
|
||||
grep -q '^ParallelDownloads' /etc/pacman.conf || \
|
||||
sudo sed -i '/^\[options\]/a ParallelDownloads = 8' /etc/pacman.conf
|
||||
fi
|
||||
ok "pacman.conf tuned"
|
||||
|
||||
# --- multilib (optional, off by default) ----------------------------------
|
||||
if [[ "${ENABLE_MULTILIB:-0}" == "1" ]]; then
|
||||
step "enabling [multilib]"
|
||||
run sudo sed -i '/^#\[multilib\]$/,+1 s/^#//' /etc/pacman.conf
|
||||
fi
|
||||
|
||||
# --- mirrors ---------------------------------------------------------------
|
||||
if have reflector; then
|
||||
step "refreshing mirrorlist with reflector (this can take a minute)"
|
||||
run sudo reflector --protocol https --latest 20 --sort rate \
|
||||
--save /etc/pacman.d/mirrorlist || warn "reflector failed; keeping existing mirrorlist"
|
||||
else
|
||||
skip "reflector not installed yet — mirrors will be refreshed on the next run"
|
||||
fi
|
||||
|
||||
step "synchronising package databases"
|
||||
run sudo pacman -Syu --noconfirm
|
||||
|
||||
ok "preflight complete"
|
||||
Reference in New Issue
Block a user