feat: Added option to prevent rebuild of the image (#1970)

This commit is contained in:
Kroese
2026-07-26 00:02:17 +02:00
committed by GitHub
parent 0a3bff5a7d
commit 4e35ead612
4 changed files with 82 additions and 56 deletions
+62
View File
@@ -951,3 +951,65 @@ EOF
return 0
}
extractBootImage() {
local iso="$1"
local dir="$2"
local desc="$3"
local tmp="$TMP/boot-images"
local image="$tmp/eltorito_img1_bios.img"
local max_size=$((32 * 1024 * 1024))
ETFS="boot.img"
[ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0
rm -f "$dir/$ETFS" || return 1
rm -rf "$tmp" || return 1
LC_ALL=C xorriso \
-no_rc \
-osirrox on \
-indev "$iso" \
-extract_boot_images "$tmp" >/dev/null 2>&1 || {
local rc=$?
rm -rf "$tmp" || true
(( rc > 128 )) && exit "$rc"
error "Failed to extract boot image from $desc ISO!"
return 1
}
if [ ! -s "$image" ]; then
rm -rf "$tmp" || true
error "Failed to locate BIOS boot image in $desc ISO!"
return 1
fi
local size
if ! size=$(stat -c%s "$image"); then
rm -rf "$tmp" || true
error "Failed to determine BIOS boot image size in $desc ISO!"
return 1
fi
if (( size > max_size )); then
rm -rf "$tmp" || true
error "The BIOS boot image in $desc ISO exceeds 32 MB!"
return 1
fi
if ! mv -f "$image" "$dir/$ETFS"; then
rm -rf "$tmp" || true
error "Failed to save boot image from $desc ISO!"
return 1
fi
rm -rf "$tmp" || return 1
return 0
}
return 0