commit dabded3e86e4035efabed9e550c2e6c6379eeb0f
parent 04a285fdd1860d57d611110ad08e1a53eb1f9a1d
Author: Divan Visagie <me@divanv.com>
Date: Fri, 27 Nov 2026 22:32:55 +0100
iso: clear the build VM's old containers and images in the VM, not on the host
The cleanup added in the last change sat inside the single-quoted ssh block, and its comment had an
apostrophe ("osbuild's"). That ended the quote early, so half the block ran on the host and the
live image was never sent to the VM: the ISO build failed twice. The comment is out of the block
now, and the block is checked to hold no apostrophe.
Also: podman rm -af before rmi -af (a stopped run's containers hold their images), and the free-space
check uses findmnt -b, which the VM's tools understand.
Diffstat:
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/linux/live/build.sh b/linux/live/build.sh
@@ -35,6 +35,10 @@ docker build -q --target live -t sectorf-live-installer -f "$ROOT/Containerfile"
--build-arg PAYLOAD_REF="$PAYLOAD" --build-arg TARGET_IMGREF="$TARGET_IMGREF" --build-arg DEBUG_SSH_KEY="$debug_key" "$ROOT" >/dev/null
say "the build VM"
+# Cleaning up in the block below (no apostrophes in it: it is one single-quoted string): each run
+# sends or pulls what it needs again, so what earlier runs left (old payloads are several GB each)
+# only fills the disk. Containers a stopped run left behind hold their images, so they go first.
+# The osbuild cache is cleared when less than 30 GB is free.
pid="$ROOT/out/qemu.pid"
if [[ -f "$pid" ]] && kill -0 "$(cat "$pid")" 2>/dev/null; then :; else "$VM" start; "$VM" wait; fi
"$VM" ssh '
@@ -47,10 +51,9 @@ if [[ -f "$pid" ]] && kill -0 "$(cat "$pid")" 2>/dev/null; then :; else "$VM" st
}
mkdir -p /var/builder/containers /var/builder/out
mountpoint -q /var/lib/containers || mount --bind /var/builder/containers /var/lib/containers
- # Each run sends or pulls what it needs again, so what is left from earlier runs (old payloads are
- # several GB each) only fills the disk; and osbuild's cache is cleared when less than 30 GB is free.
+ podman rm -af -t 0 >/dev/null 2>&1 || true
podman rmi -af >/dev/null 2>&1 || true
- [ "$(df --output=avail -BG /var/builder | tail -1 | tr -dc 0-9)" -ge 30 ] || rm -rf /var/builder/cache/*
+ [ "$(findmnt -b -n -o AVAIL /var/builder)" -ge 32212254720 ] || rm -rf /var/builder/cache/*
df -h /var/builder | tail -1'
say "sending the live image to the VM"