Pass the repository URL into the build container as a file

The mirror guard and the image mirrorlist run inside build-in-container.sh,
where the host-side variable does not exist. Write /job/mirror.txt on the host
and read it in the container.
This commit is contained in:
Archipelago 2026-11-13 17:24:57 +03:00
parent f20e8e103a
commit cbd9790d0f

View file

@ -49,6 +49,8 @@ toolroot="$work/tools/root.x86_64"
mirror=${ARCHIPELAGO_MIRROR_URL:-'https://mirror.nw-sys.ru/archlinux/$repo/os/$arch'}
[[ $mirror != *$'\n'* && $mirror != *$'\r'* ]]
printf 'Server = %s\n' "$mirror" > "$toolroot/etc/pacman.d/mirrorlist"
# The container script writes the same value into the image; /job is this work dir.
printf '%s\n' "$mirror" > "$work/mirror.txt"
cat > "$work/update.json" <<'PROFILE'
@@UPDATE_PROFILE@@
PROFILE
@ -254,6 +256,7 @@ rm -f /job/core/etc/ssh/ssh_host_* /job/core/etc/.pwd.lock
# 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 ;;