mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-10-26 02:48:38 -04:00
pi-gen: clear leftover BUILD_DIR at startup (robust to killed builds)
A SIGTERM/kill (e.g. `systemctl stop`) skips the EXIT-trap cleanup, leaving /var/tmp/wrolpi-build-pi-gen behind. The next build's `mv pi-gen-bookworm-arm64 wrolpi-build-pi-gen` would then nest into the stale dir and fail. Remove the leftover (and intermediate zip/unzip dir) at startup, mirroring the debian build, stripping immutable flags off blob files first. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
33498504b0
commit
3929642167
1 changed files with 8 additions and 0 deletions
|
|
@ -93,6 +93,14 @@ fi
|
|||
[[ -f "${BLOB_CACHE}/map-overview.pmtiles" && -s "${BLOB_CACHE}/map-overview.pmtiles" ]] || \
|
||||
(echo "ERROR: Failed to download map overview!" && exit 1)
|
||||
|
||||
# Clear leftovers from a previous build before unpacking. The EXIT trap
|
||||
# normally cleans up, but a SIGTERM/kill (e.g. `systemctl stop`) skips it and
|
||||
# leaves BUILD_DIR behind -- the `mv` below would then nest the new tree inside
|
||||
# the stale one and break the build. Strip the immutable flag off blob files
|
||||
# first (the chroot sets chattr +i), or rm -rf cannot remove them.
|
||||
chattr -i "${BUILD_DIR}"/work/*/stage*/rootfs/opt/wrolpi-blobs/* 2>/dev/null || :
|
||||
rm -rf "${BUILD_DIR}" /var/tmp/pi-gen-bookworm-arm64 /var/tmp/bookworm-arm64.zip
|
||||
|
||||
# Get the latest pi-gen code.
|
||||
wget https://github.com/RPi-Distro/pi-gen/archive/refs/heads/bookworm-arm64.zip -O /var/tmp/bookworm-arm64.zip
|
||||
unzip /var/tmp/bookworm-arm64.zip -d /var/tmp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue