fix: Skip exisiting boot image

This commit is contained in:
Kroese 2024-05-10 16:28:40 +02:00 committed by GitHub
parent 5bfcb0c2cc
commit 45421e257e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1199,15 +1199,17 @@ prepareLegacy() {
local iso="$1" local iso="$1"
local dir="$2" local dir="$2"
local file="$dir/boot.img"
ETFS="boot.img" ETFS=$(basename "$file")
rm -f "$dir/$ETFS" [ -f "$file" ] && [ -s "$file" ] && return 0
rm -f "$file"
local len offset local len offset
len=$(isoinfo -d -i "$iso" | grep "Nsect " | grep -o "[^ ]*$") len=$(isoinfo -d -i "$iso" | grep "Nsect " | grep -o "[^ ]*$")
offset=$(isoinfo -d -i "$iso" | grep "Bootoff " | grep -o "[^ ]*$") offset=$(isoinfo -d -i "$iso" | grep "Bootoff " | grep -o "[^ ]*$")
dd "if=$iso" "of=$dir/$ETFS" bs=2048 "count=$len" "skip=$offset" status=none && return 0 dd "if=$iso" "of=$file" bs=2048 "count=$len" "skip=$offset" status=none && return 0
return 1 return 1
} }