fix: incremental rootfs builds so stale archives are never deployed
The deploy failed with "grub-install: command not found" in the chroot — the installed rootfs archive was built BEFORE the BOOT/grub injection, so it had no bootloader at all. build-iso.sh / build-image.sh only rebuilt the rootfs when the archive was missing, never when sources changed, so development fixes were silently absent from deployed images. - build-rootfs.sh: incremental staleness check — skips a rebuild only when no input (scripts/, btrfs/, overlays/, editions/<e>/, versions.mk, toolchain debs) is newer than the artifact; FORCE=1 rebuilds anyway. - build-iso.sh / build-image.sh: always delegate freshness to build-rootfs.sh instead of gating on file existence. - deploy-disk.sh: defensive check that grub-install exists in the deployed rootfs, with a clear "stale archive — rebuild" message instead of a bare "command not found". - docs/building.md: incremental-build note (FORCE=1 / make clean).
This commit is contained in:
@@ -42,6 +42,27 @@ ROOTFS="$ROOTFS_DIR/$EDITION"
|
||||
ARTIFACT="$ARTIFACT_DIR/arcline-$EDITION-$VERSION-$ARCH.tar.xz"
|
||||
|
||||
mkdir -p "$ROOTFS_DIR" "$LOG_DIR" "$ARTIFACT_DIR"
|
||||
|
||||
# ── staleness check ─────────────────────────────────────────────────────────
|
||||
# Incremental builds: skip rebuilding when no input changed since the last
|
||||
# artifact. This is what makes `make iso-<edition>` fast when nothing changed,
|
||||
# AND it catches stale archives during development (the bug class that shipped
|
||||
# a rootfs with no grub-install). Force with FORCE=1 or `make clean`.
|
||||
newer_input() { # <artifact> → 0 if any input is newer than the artifact
|
||||
local art="$1"
|
||||
[[ -f "$art" ]] || return 0
|
||||
find "$ROOT/scripts" "$ROOT/btrfs" "$ROOT/overlays" "$EDIR" \
|
||||
-type f -newer "$art" -print -quit 2>/dev/null | grep -q . && return 0
|
||||
[[ -d "$DEB_DIR" ]] && find "$DEB_DIR" -name '*.deb' -newer "$art" -print -quit 2>/dev/null | grep -q . && return 0
|
||||
[[ "$ROOT/versions.mk" -nt "$art" ]] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
if [[ "${FORCE:-0}" != "1" && -d "$ROOTFS" && -f "$ARTIFACT" ]] && ! newer_input "$ARTIFACT"; then
|
||||
log "rootfs '$EDITION' is up to date — skipping rebuild ($ARTIFACT)"
|
||||
log " (FORCE=1 rebuilds anyway)"
|
||||
exit 0
|
||||
fi
|
||||
rm -rf "$ROOTFS" "$ARTIFACT"
|
||||
|
||||
log "═══ building Arcline $EDITION rootfs ($DISTRO_NAME $VERSION) ═══"
|
||||
|
||||
Reference in New Issue
Block a user