diff --git a/iso/builder/build.sh b/iso/builder/build.sh index 5ff446f..fce5b46 100755 --- a/iso/builder/build.sh +++ b/iso/builder/build.sh @@ -126,6 +126,37 @@ resolve_iso_version() { resolve_audit_version } +sync_builder_workdir() { + src_dir="$1" + dst_dir="$2" + + mkdir -p "$dst_dir" + + # Historical bug: old workdirs could keep config/bootloaders/grub-pc even + # after the source tree moved to grub-efi only. Remove bootloaders eagerly + # so reused workdirs cannot leak stale templates into a new ISO build. + rm -rf "$dst_dir/config/bootloaders" + + rsync -a --delete \ + --exclude='cache/' \ + --exclude='chroot/' \ + --exclude='.build/' \ + --exclude='*.iso' \ + --exclude='*.packages' \ + --exclude='*.contents' \ + --exclude='*.files' \ + "$src_dir/" "$dst_dir/" + + if [ ! -f "$dst_dir/config/bootloaders/grub-efi/grub.cfg" ]; then + echo "ERROR: staged workdir is missing config/bootloaders/grub-efi/grub.cfg" >&2 + exit 1 + fi + if [ -e "$dst_dir/config/bootloaders/grub-pc" ]; then + echo "ERROR: stale config/bootloaders/grub-pc remained in staged workdir" >&2 + exit 1 + fi +} + iso_list_files() { iso_path="$1" @@ -1181,15 +1212,7 @@ echo "=== preparing staged overlay (${BUILD_VARIANT}) ===" mkdir -p "${BUILD_WORK_DIR}" "${OVERLAY_STAGE_DIR}" # Sync builder config into variant work dir, preserving lb cache. -rsync -a --delete \ - --exclude='cache/' \ - --exclude='chroot/' \ - --exclude='.build/' \ - --exclude='*.iso' \ - --exclude='*.packages' \ - --exclude='*.contents' \ - --exclude='*.files' \ - "${BUILDER_DIR}/" "${BUILD_WORK_DIR}/" +sync_builder_workdir "${BUILDER_DIR}" "${BUILD_WORK_DIR}" # Share deb package cache across variants. # Restore: populate work dir cache from shared cache before build.