Freeze the repository address in images, fix console wrapper mode, speed up builds

- build-iso.sh writes ARCHIPELAGO_MIRROR_URL into the image and airootfs
  mirrorlists instead of the hardcoded rolling mirror, and refuses any
  repository that is not mirror.nw-sys.ru (rolling or snapshot).
- package.sh ships the getty@tty1 onboarding drop-in under /usr/lib.
- Core/Container Runner use plain getty on tty1; kmscon stays desktop-only.
- Cache the generated locale archive by glibc version and locale.gen.
- Commit build repositories with --fsync=0 (artifacts are fsck-verified).
- Let mkarchiso compress the live image with all available CPUs.
This commit is contained in:
Archipelago 2026-11-13 15:23:49 +03:00
parent 764234b419
commit 12b5f92b8c
5 changed files with 60 additions and 42 deletions

View file

@ -186,18 +186,35 @@ ln -sfn /usr/share/zoneinfo/UTC /job/core/etc/localtime
mkdir -p /job/core/etc/systemd/network
cp /job/core/usr/lib/archipelago/defaults/20-wired.network /job/core/etc/systemd/network/
ln -sfn /run/systemd/resolve/stub-resolv.conf /job/core/etc/resolv.conf
systemctl --root=/job/core disable getty@tty1 archipelago-firstboot@tty1
systemctl --root=/job/core enable systemd-networkd systemd-resolved systemd-timesyncd sshd archipelago-ssh-keys archipelago-keyring kmsconvt@tty1 ostree-remount
# kmscon owns tty1 on Core/Container Runner (the login wrapper runs onboarding)
# and VTs opened by logind (tty2+). Desktops disable the tty1 instance and keep
# tty2+ only. The packaged OnFailure fallback starts getty with the same wrapper.
mkdir -p /job/core/etc/kmscon /job/core/etc/systemd/system
cp /job/core/usr/lib/archipelago/defaults/kmscon.conf /job/core/etc/kmscon/kmscon.conf
ln -sfn /usr/lib/systemd/system/kmsconvt@.service /job/core/etc/systemd/system/autovt@.service
systemctl --root=/job/core disable archipelago-firstboot@tty1
systemctl --root=/job/core enable systemd-networkd systemd-resolved systemd-timesyncd sshd archipelago-ssh-keys archipelago-keyring getty@tty1 ostree-remount
# Core and Container Runner use the plain kernel console: vconsole.conf already
# selects Terminus, and kmscon cannot start without mesa (every render engine
# needs libEGL/libgbm/libGLESv2, which the Arch package does not depend on). The
# packaged getty@tty1 drop-in runs the same onboarding wrapper as kmscon did.
if [[ $ARCHIPELAGO_BUILD_PROFILE == gnome-probe ]]; then
# Desktop purposes ship mesa, so kmscon can serve the VTs logind opens.
mkdir -p /job/core/etc/kmscon /job/core/etc/systemd/system
cp /job/core/usr/lib/archipelago/defaults/kmscon.conf /job/core/etc/kmscon/kmscon.conf
ln -sfn /usr/lib/systemd/system/kmsconvt@.service /job/core/etc/systemd/system/autovt@.service
fi
# Generate every locale supplied by glibc, including non-UTF-8 variants. This
# shared Core output is inherited by every Purpose; never borrow host locales.
sed -i -E 's/^#[[:space:]]*([a-z][a-z][a-z]?_[A-Z][A-Z][^[:space:]]*[[:space:]]+[^[:space:]#]+)[[:space:]]*$/\1/' /job/core/etc/locale.gen
arch-chroot /job/core locale-gen > /job/evidence/locales.log 2>&1
# localedef is the most expensive step of Core (882 locales, ~28 min on the lab
# worker). The archive is a pure function of the glibc version and locale.gen, so
# cache it across builds; any change to either invalidates the key.
locale_key=$( { arch-chroot /job/core pacman -Q glibc; sha256sum /job/core/etc/locale.gen; } |
sha256sum | cut -d' ' -f1 )
locale_cache=${ARCHIPELAGO_LOCALE_CACHE:-$(dirname "$cache")/locale-archive}
mkdir -p "$locale_cache"
if [[ -f $locale_cache/$locale_key ]]; then
install -Dm0644 "$locale_cache/$locale_key" /job/core/usr/lib/locale/locale-archive
printf 'reused cached locale archive %s\n' "$locale_key" > /job/evidence/locales.log
else
arch-chroot /job/core locale-gen > /job/evidence/locales.log 2>&1
install -Dm0644 /job/core/usr/lib/locale/locale-archive "$locale_cache/$locale_key"
fi
arch-chroot /job/core locale -a > /job/evidence/locales.txt
if [[ $ARCHIPELAGO_BUILD_PROFILE == gnome-probe ]]; then
@@GNOME_FINALIZE@@
@ -230,8 +247,16 @@ 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
# Build transport must not become the installed system's repository policy.
printf 'Server = https://mirror.nw-sys.ru/archlinux/$repo/os/$arch\n' > /job/core/etc/pacman.d/mirrorlist
# 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.
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/*
mkdir -p /job/core/var /job/core/sysroot /job/core/efi
@ -253,13 +278,13 @@ files retain runtime paths; metadata and installed-file validation are distinct.
EOF
printf '%s\n' "$snapshot" > /job/layer/metadata/snapshot
ostree --repo=/job/repo init --mode=archive
layercommit=$(ostree --repo=/job/repo commit -b layers/core --tree=dir=/job/layer --add-metadata-string=archipelago.snapshot="$snapshot")
layercommit=$(ostree --repo=/job/repo commit --fsync=0 -b layers/core --tree=dir=/job/layer --add-metadata-string=archipelago.snapshot="$snapshot")
ostree --repo=/job/repo checkout --force-copy --subpath=payload "$layercommit" /job/composed
ostree --repo=/job/repo commit -b core --tree=dir=/job/composed --add-metadata-string=archipelago.snapshot="$snapshot" --add-metadata-string=archipelago.layer-core="$layercommit"
ostree --repo=/job/repo commit --fsync=0 -b core --tree=dir=/job/composed --add-metadata-string=archipelago.snapshot="$snapshot" --add-metadata-string=archipelago.layer-core="$layercommit"
mkdir -p /job/overlay/payload/usr/share/archipelago /job/overlay/metadata
printf 'Archipelago managed overlay test\n' > /job/overlay/payload/usr/share/archipelago/test-marker
printf '%s\n' "$snapshot" > /job/overlay/metadata/snapshot
ostree --repo=/job/repo commit -b test-marker --tree=dir=/job/overlay --add-metadata-string=archipelago.snapshot="$snapshot"
ostree --repo=/job/repo commit --fsync=0 -b test-marker --tree=dir=/job/overlay --add-metadata-string=archipelago.snapshot="$snapshot"
fi
# Minimal UEFI archiso profile based on packaged releng boot integration.
if [[ $(cat /job/build-output) == ostree ]]; then
@ -278,7 +303,7 @@ install_dir="arch"
bootmodes=('uefi.systemd-boot')
pacman_conf="pacman.conf"
airootfs_image_type="squashfs"
airootfs_image_tool_options=('-comp' 'zstd' '-Xcompression-level' '3' '-processors' '1')
airootfs_image_tool_options=('-comp' 'zstd' '-Xcompression-level' '3' '-processors' "$(nproc)")
kernel_params_x86_64="console=tty0 console=ttyS0,115200"
file_permissions=(["/etc/shadow"]="0:0:400" ["/root"]="0:0:750")
EOF
@ -290,7 +315,7 @@ elif [[ $ARCHIPELAGO_BUILD_PROFILE == container-runner ]]; then
fi
mkdir -p /job/profile/airootfs/etc/mkinitcpio.conf.d /job/profile/airootfs/root
mkdir -p /job/profile/airootfs/etc/pacman.d
printf 'Server = https://mirror.nw-sys.ru/archlinux/$repo/os/$arch\n' > /job/profile/airootfs/etc/pacman.d/mirrorlist
printf 'Server = %s\n' "$mirror" > /job/profile/airootfs/etc/pacman.d/mirrorlist
cat > /job/profile/airootfs/etc/mkinitcpio.conf.d/archiso.conf <<'EOF'
HOOKS=(base udev modconf archiso archiso_loop_mnt block filesystems keyboard)
COMPRESSION="zstd"
@ -300,21 +325,11 @@ printf 'root::14871::::::\n' > /job/profile/airootfs/etc/shadow
printf 'archipelago-live\n' > /job/profile/airootfs/etc/hostname
printf 'LANG=C.UTF-8\n' > /job/profile/airootfs/etc/locale.conf
printf 'KEYMAP=us\nFONT=ter-v24b\n' > /job/profile/airootfs/etc/vconsole.conf
mkdir -p /job/profile/airootfs/etc/kmscon
cat > /job/profile/airootfs/etc/kmscon/kmscon.conf <<'KMS'
# Userspace KMS console. PSF backend uses the shipped Terminus bitmap directly.
font-engine=psf
font-name=/usr/share/kbd/consolefonts/ter-v24b.psf.gz
font-size=0
xkb-model=pc105
xkb-layout=us,ru
xkb-options=grp:alt_shift_toggle
login=/usr/bin/archipelago-console-login
KMS
# Live console: plain kernel console with Terminus (vconsole.conf above) and a
# getty on tty1. kmscon is deliberately not enabled: the live image ships no
# mesa, so it has no render engine and would leave tty1 blank.
mkdir -p /job/profile/airootfs/etc/systemd/system/getty.target.wants
ln -sfn /usr/lib/systemd/system/kmsconvt@.service /job/profile/airootfs/etc/systemd/system/getty.target.wants/kmsconvt@tty1.service
ln -sfn /usr/lib/systemd/system/kmsconvt@.service /job/profile/airootfs/etc/systemd/system/autovt@.service
rm -f /job/profile/airootfs/etc/systemd/system/getty.target.wants/getty@tty1.service
ln -sfn /usr/lib/systemd/system/getty@.service /job/profile/airootfs/etc/systemd/system/getty.target.wants/getty@tty1.service
ln -s /usr/share/zoneinfo/UTC /job/profile/airootfs/etc/localtime
mkdir -p /job/profile/airootfs/etc/systemd/system
cat > /job/profile/packages.x86_64 <<'EOF'
@ -333,7 +348,6 @@ gptfdisk
parted
sudo
openssh
kmscon
terminus-font
EOF
cp /etc/pacman.conf /job/profile/pacman.conf

View file

@ -1,7 +1,9 @@
# Container Runner installed-system defaults. No graphical target or desktop stack.
systemctl --root=/job/core disable systemd-networkd archipelago-firstboot@tty1 getty@tty1 archipelago-firstboot@ttyS0 serial-getty@ttyS0
# Keep the console onboarding path; the installed system is a multi-user server.
systemctl --root=/job/core enable NetworkManager cockpit.socket kmsconvt@tty1
systemctl --root=/job/core disable systemd-networkd archipelago-firstboot@tty1 archipelago-firstboot@ttyS0 serial-getty@ttyS0
# The server console is the plain kernel console (Terminus via vconsole.conf) with
# getty on tty1; the packaged getty@tty1 drop-in runs onboarding. kmscon needs
# mesa, which this image does not carry, so it is not enabled here.
systemctl --root=/job/core enable NetworkManager cockpit.socket getty@tty1
systemctl --root=/job/core set-default multi-user.target
mkdir -p /job/core/etc/cockpit /job/core/etc/NetworkManager/conf.d /job/core/etc/sudoers.d
# Cockpit's stock self-signed certificate; never allow plaintext or unauthenticated use.

View file

@ -101,7 +101,7 @@ rm "$pkg/runtime/usr/lib/archipelago/defaults/os-release" "$pkg/runtime/usr/lib/
cp -a "$pkg/runtime/." "$stage/"
printf 'ARCHIPELAGO_PHASE\tcompose\n'
python /job/layer-delta.py capture /job/core-base "$stage" /job/purpose-layer purpose/server/container-runner
purpose_layer=$(ostree --repo=/job/repo commit -b layers/purpose/server/container-runner --tree=dir=/job/purpose-layer \
purpose_layer=$(ostree --repo=/job/repo commit --fsync=0 -b layers/purpose/server/container-runner --tree=dir=/job/purpose-layer \
--add-metadata-string=archipelago.snapshot="$snapshot")
printf '%s\n' "$purpose_layer" > /job/evidence/purpose-layer.commit
# Retain the original transaction output until commit checkout and composition
@ -137,7 +137,7 @@ cp /job/evidence/core-packages.txt /job/core/usr/lib/archipelago/packages.txt
find /job/core/usr/lib/archipelago/package-db/local -name install -exec sha256sum '{}' + > /job/core/usr/lib/archipelago/hook-policy/scriptlets.sha256
mv /job/core/etc /job/core/usr/etc
mv /job/core /job/composed
ostree --repo=/job/repo commit -b core --tree=dir=/job/composed \
ostree --repo=/job/repo commit --fsync=0 -b core --tree=dir=/job/composed \
--add-metadata-string=archipelago.snapshot="$snapshot" \
--add-metadata-string=archipelago.layer-core="$core_layer" \
--add-metadata-string=archipelago.layer-purpose="$purpose_layer"

View file

@ -101,7 +101,7 @@ rm "$pkg/runtime/usr/lib/archipelago/defaults/os-release" "$pkg/runtime/usr/lib/
cp -a "$pkg/runtime/." "$stage/"
printf 'ARCHIPELAGO_PHASE\tcompose\n'
python /job/layer-delta.py capture /job/core-base "$stage" /job/purpose-layer
purpose_layer=$(ostree --repo=/job/repo commit -b layers/purpose/desktop/gnome --tree=dir=/job/purpose-layer \
purpose_layer=$(ostree --repo=/job/repo commit --fsync=0 -b layers/purpose/desktop/gnome --tree=dir=/job/purpose-layer \
--add-metadata-string=archipelago.snapshot="$snapshot")
printf '%s\n' "$purpose_layer" > /job/evidence/purpose-layer.commit
# Retain the original transaction output until commit checkout and composition
@ -136,7 +136,7 @@ cp /job/evidence/core-packages.txt /job/core/usr/lib/archipelago/packages.txt
find /job/core/usr/lib/archipelago/package-db/local -name install -exec sha256sum '{}' + > /job/core/usr/lib/archipelago/hook-policy/scriptlets.sha256
mv /job/core/etc /job/core/usr/etc
mv /job/core /job/composed
ostree --repo=/job/repo commit -b core --tree=dir=/job/composed \
ostree --repo=/job/repo commit --fsync=0 -b core --tree=dir=/job/composed \
--add-metadata-string=archipelago.snapshot="$snapshot" \
--add-metadata-string=archipelago.layer-core="$core_layer" \
--add-metadata-string=archipelago.layer-purpose="$purpose_layer"

View file

@ -99,12 +99,14 @@ fi
exec /bin/login -p
EOF
chmod 0755 "$pkg/runtime/usr/bin/archipelago-console-login"
# Fallback getty on tty1 must offer the same onboarding if kmscon fails.
mkdir -p "$pkg/runtime/etc/systemd/system/getty@tty1.service.d"
cat > "$pkg/runtime/etc/systemd/system/getty@tty1.service.d/50-archipelago-console-login.conf" <<'EOF'
# getty@tty1 must offer the same onboarding as the kmscon login program. This is
# a vendor drop-in under /usr/lib: an /etc path is not packaged at all (the recipe
# copies runtime/usr only) and would depend on the deployment's /etc merge.
mkdir -p "$pkg/runtime/usr/lib/systemd/system/getty@tty1.service.d"
cat > "$pkg/runtime/usr/lib/systemd/system/getty@tty1.service.d/50-archipelago-console-login.conf" <<'EOF'
[Service]
ExecStart=
ExecStart=-/sbin/agetty --login-program /usr/bin/archipelago-console-login --noclear %I $TERM
ExecStart=-/usr/bin/agetty --noreset --noclear --login-program /usr/bin/archipelago-console-login - ${TERM}
EOF
cat > "$pkg/runtime/usr/lib/archipelago/defaults/20-wired.network" <<'EOF'
[Match]