Auto pull german mirrors before install

This commit is contained in:
2026-07-06 22:02:11 +02:00
parent 4023bea6af
commit ecce1db026
2 changed files with 17 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
# Rank download mirrors before pacstrap — WITHOUT reflector (not on the ISO).
# Pull a Germany/HTTPS list from Arch's official mirrorlist generator, already
# ordered by mirror status/score, and activate it. Only needs curl (on the ISO)
# and hits archlinux.org's CDN, so it doesn't depend on the slow current mirror.
# pacstrap copies this list into the installed system, so it speeds up the base
# install AND every later pacman run. Falls back to the shipped list on failure.
url='https://archlinux.org/mirrorlist/?country=DE&protocol=https&ip_version=4&use_mirror_status=on'
tmp="$(mktemp)"
if curl -fsS --max-time 20 "$url" -o "$tmp" && grep -q '^#Server' "$tmp"; then
cp -f /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak 2>/dev/null || true
sed 's/^#Server/Server/' "$tmp" > /etc/pacman.d/mirrorlist
info "mirrorlist → Germany/https, $(grep -c '^Server' /etc/pacman.d/mirrorlist) mirrors (status-ranked)"
else
info "could not fetch DE mirrorlist — keeping the ISO's list"
fi
rm -f "$tmp"