diff options
| author | Craig Jennings <c@cjennings.net> | 2026-05-19 13:12:56 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-05-19 13:12:56 -0500 |
| commit | 21b745d7634cf8e743020b591df101b439883511 (patch) | |
| tree | be199405a2ef05e1e34a65b65ebb90e45a2b497e /scripts | |
| parent | 9405b1fc9984e43b0297d2bb89dea1666e1f4853 (diff) | |
| download | archangel-21b745d7634cf8e743020b591df101b439883511.tar.gz archangel-21b745d7634cf8e743020b591df101b439883511.zip | |
feat(build): route VM-internal pacstrap through host pacoloco
The build-host pacoloco routing from e2eb958 only covered mkarchiso's pacstrap. VMs spawned by scripts/test-install.sh ran their own pacstrap inside the guest, fetching ~600 packages per config from upstream and re-hitting the same archzfs corruption that bites the build host. A full 12-config test-install run exposed 7200+ package downloads to upstream flake.
I added a routing step to run_install() in test-install.sh, after the config file gets SCP'd to the VM and before archangel runs. It detects pacoloco on the host (port 9129, same probe as build.sh's) and rewrites the live system's /etc/pacman.conf over SSH. [core] and [extra] swap their Include lines for Server lines pointing at 10.0.2.2:9129/repo/archlinux/$repo/os/$arch. A preempt [archzfs] block lands ahead of archangel's default insertion.
10.0.2.2 is QEMU's SLIRP default gateway as seen from the guest, so the host's localhost:9129 maps to that address inside the VM. Pacoloco binds 0.0.0.0:9129, reachable from there without firewall changes.
The preempt matters because archangel's install_base checks for an existing [archzfs] block in /etc/pacman.conf and skips its own insertion when one is already there. Writing the pacoloco-routed [archzfs] up front means archangel keeps the routed version. The installed system's $MNTPOINT/etc/pacman.conf isn't touched: it gets upstream URLs like before, since the installed system shouldn't depend on the test host's proxy.
The status message uses a plain echo rather than test-install.sh's info() function. run_install() runs inside a bash -c subshell at line 864 that only exports ssh_cmd and run_install via declare -f. A bare info call there resolves to /usr/bin/info (the GNU info reader) and prints a confusing "No menu item" error. An inline comment in the code records the pitfall.
Verified end-to-end with scripts/test-install.sh single-disk: pacoloco's cache grew from 77MB (post-build) to 953MB (post-VM-install), the VM's pacstrap completed cleanly, and the install verified. Bats: still 181.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/test-install.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scripts/test-install.sh b/scripts/test-install.sh index e5afcfb..7f2bcda 100755 --- a/scripts/test-install.sh +++ b/scripts/test-install.sh @@ -430,6 +430,27 @@ run_install() { sshpass -p "$SSH_PASSWORD" scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ -P "$SSH_PORT" "$config" root@localhost:/root/test.conf 2>/dev/null + # Route VM pacstrap through the host's pacoloco when one is running + # locally. Catches archzfs corruption at the cache layer and speeds + # repeated VM test runs (no upstream re-fetch per config). 10.0.2.2 + # is QEMU's SLIRP host gateway as seen from inside the guest, so + # the host's localhost:9129 maps to 10.0.2.2:9129 in there. Touches + # only the live system's /etc/pacman.conf; the installed system's + # $MNTPOINT/etc/pacman.conf keeps upstream URLs for ongoing use. + if (echo > /dev/tcp/localhost/9129) 2>/dev/null; then + # Plain echo, not info(): run_install gets invoked from a + # bash -c subshell at line 864 that only declares ssh_cmd and + # run_install via declare -f, so a bare info call resolves to + # /usr/bin/info (the GNU info reader) instead of the function. + echo "[INFO] Routing VM pacstrap through host pacoloco at 10.0.2.2:9129" + ssh_cmd "sed -i 's|^Include = /etc/pacman.d/mirrorlist|Server = http://10.0.2.2:9129/repo/archlinux/\$repo/os/\$arch|' /etc/pacman.conf" + # Preempt archangel's [archzfs] insertion. install_base at + # installer/archangel:716 skips adding [archzfs] when the block + # is already present, so writing it here with pacoloco URLs + # wins over the upstream URL the installer would otherwise use. + ssh_cmd "printf '[archzfs]\nServer = http://10.0.2.2:9129/repo/archzfs\nSigLevel = Never\n' >> /etc/pacman.conf" + fi + # Run the installer (NO_ENCRYPT is set in the config file, not via flag) ssh_cmd "archangel --config-file /root/test.conf" || return 1 |
