diff --git a/adapters/build-iso.sh b/adapters/build-iso.sh index 915e129..e261941 100644 --- a/adapters/build-iso.sh +++ b/adapters/build-iso.sh @@ -120,6 +120,17 @@ cat > "$work/build-in-container.sh" <<'BUILD' set -euxo pipefail export LC_ALL=C export ARCHIPELAGO_BUILD_PROFILE=$(cat /job/build-profile) +# The image keeps the repository it was composed from: either the public rolling +# mirror or the immutable snapshot bound to this build. An internal build +# transport must never leak in, and a snapshot build must not silently fall back +# to the rolling mirror - that is what broke updates on deployed hosts when the +# mirror pruned a pinned package. Purpose builds skip the Core-tree block below, +# so the value is read once here for every profile. +mirror=$(cat /job/mirror.txt) +case $mirror in + 'https://mirror.nw-sys.ru/archlinux'*|'https://mirror.nw-sys.ru/archipelago/arch-repo-snapshot/'*) ;; + *) echo "Installed-system repository must be mirror.nw-sys.ru, got: $mirror" >&2; exit 1 ;; +esac if [[ ! -f /etc/pacman.d/gnupg/trustdb.gpg ]]; then pacman-key --init pacman-key --populate archlinux @@ -251,16 +262,6 @@ for database in passwd shadow group gshadow; do done rm -rf /job/core/etc/pacman.d/gnupg rm -f /job/core/etc/ssh/ssh_host_* /job/core/etc/.pwd.lock -# The installed system keeps the repository it was composed from: either the -# public rolling mirror or the immutable snapshot bound to this build. An -# internal build transport must never leak into the image, and a snapshot build -# must not silently fall back to the rolling mirror - that is what broke updates -# on already deployed hosts when the mirror pruned a pinned package. -mirror=$(cat /job/mirror.txt) -case $mirror in - 'https://mirror.nw-sys.ru/archlinux'*|'https://mirror.nw-sys.ru/archipelago/arch-repo-snapshot/'*) ;; - *) echo "Installed-system repository must be mirror.nw-sys.ru, got: $mirror" >&2; exit 1 ;; -esac printf 'Server = %s\n' "$mirror" > /job/core/etc/pacman.d/mirrorlist mv /job/core/etc /job/core/usr/etc rm -rf /job/core/var /job/core/home /job/core/root /job/core/srv /job/core/opt /job/core/mnt /job/core/usr/local /job/core/boot/*