aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-19 12:07:27 -0500
committerCraig Jennings <c@cjennings.net>2026-05-19 12:07:27 -0500
commite2eb958c4fab1d61263b724eebd861489af73359 (patch)
treea26b216d4258236bf0864f9555569b715f2c28e3
parentdb851ffba560272f1e813dd13d09fb9f88d0faff (diff)
downloadarchangel-e2eb958c4fab1d61263b724eebd861489af73359.tar.gz
archangel-e2eb958c4fab1d61263b724eebd861489af73359.zip
feat(build): route pacstrap through pacoloco when available
build.sh now checks for a pacoloco caching proxy on localhost:9129 before mkarchiso runs. When pacoloco is up, build.sh rewrites the build profile's pacman.conf to point [core], [extra], and [archzfs] at the proxy. When it isn't, the build falls back to the upstream mirrors and the GitHub-releases URL it always used. The motivation is the recurring archzfs corruption that's hit ~2 of 3 builds. The earlier cache-hygiene step (db851ff) clears the host's pacman cache so pacstrap can't reuse a corrupted package between builds. Pacoloco is the next layer. It caches successful fetches, so once a known-good copy of zfs-dkms or zfs-utils lands, future builds skip the GitHub roundtrip entirely. Pacoloco doesn't validate checksums itself, so a corrupted upstream fetch still fails the build at pacstrap. Once a clean copy lands, the cache stays clean. Detection uses bash /dev/tcp (no external dependency on nc or netcat). Two sed lines rewrite the URLs in the freshly-copied profile pacman.conf. The fallback prints an info message so the operator knows which mode the build ran in. README's "Build Host Requirements" section now lists pacoloco as an optional dependency with install + enable steps. Pacoloco is from AUR (~yay -S pacoloco~). The config in /etc/pacoloco.yaml needs an archzfs repo entry, documented in the README block. I verified end-to-end: installed pacoloco, configured /etc/pacoloco.yaml for archlinux (host mirrorlist) + archzfs (GitHub releases URL), enabled the systemd service, smoke-tested with curl (archzfs.db and core.db both served 200), then ran a full build. The build completed in ~4 minutes. The info message confirmed pacoloco routing. Pacoloco's cache filled with the freshly-fetched archzfs packages (zfs-dkms-2.4.2-1, zfs-utils-2.4.2-2) plus the Arch packages that weren't already in the host pacman cache. Build log and ISO landed at the expected paired names.
-rw-r--r--README.org16
-rwxr-xr-xbuild.sh19
2 files changed, 35 insertions, 0 deletions
diff --git a/README.org b/README.org
index 3ea1ff2..30e8e6f 100644
--- a/README.org
+++ b/README.org
@@ -47,6 +47,22 @@ The build script will report if you're missing any of these in a preflight check
- ~archiso~ package (~pacman -S archiso~) — auto-installed if missing
- ~10GB free disk space for build
+*Optional: pacoloco caching proxy* — set this up once and ~build.sh~
+detects it automatically. Pacoloco caches Arch core/extra plus the
+archzfs GitHub-releases URL, which mitigates the recurring archzfs
+corruption that bites cold-cache builds. Install + enable:
+
+#+BEGIN_SRC bash
+yay -S pacoloco
+sudo systemctl enable --now pacoloco
+#+END_SRC
+
+The default ~/etc/pacoloco.yaml~ ships an ~archlinux~ repo example;
+add an ~archzfs~ entry pointing at
+=https://github.com/archzfs/archzfs/releases/download/experimental=
+and reload the service. When pacoloco isn't running, ~build.sh~ falls
+back to the upstream URLs.
+
** Runtime Dependencies (included in ISO)
- ZFS kernel modules (via zfs-dkms)
- Btrfs tools
diff --git a/build.sh b/build.sh
index a1f1498..40a9be2 100755
--- a/build.sh
+++ b/build.sh
@@ -161,6 +161,25 @@ Server = https://github.com/archzfs/archzfs/releases/download/experimental
SigLevel = Never
EOF
+# Route pacstrap through a local pacoloco caching proxy when one is
+# running on localhost:9129. Pacoloco proxies Arch core/extra and the
+# archzfs GitHub-releases URL, caching successful fetches and serving
+# them on subsequent builds. Catches the recurring archzfs corruption
+# class — pacoloco re-fetches when a hashed file misses, and once a
+# good copy lands it stays good. Falls back to direct upstream when
+# pacoloco isn't listening so builds work on machines without the
+# optional proxy installed. See README "Build Host Requirements" for
+# the install steps.
+if (echo > /dev/tcp/localhost/9129) 2>/dev/null; then
+ info "Routing pacstrap through pacoloco at localhost:9129..."
+ sed -i 's|^Include = /etc/pacman.d/mirrorlist|Server = http://localhost:9129/repo/archlinux/$repo/os/$arch|' \
+ "$PROFILE_DIR/pacman.conf"
+ sed -i 's|^Server = https://github.com/archzfs/archzfs/releases/download/experimental$|Server = http://localhost:9129/repo/archzfs|' \
+ "$PROFILE_DIR/pacman.conf"
+else
+ info "pacoloco not detected — using upstream mirrors directly"
+fi
+
# Add ZFS and our custom packages
info "Adding ZFS and custom packages..."
cat >> "$PROFILE_DIR/packages.x86_64" << 'EOF'