mirror of
https://github.com/dockur/windows.git
synced 2026-08-03 12:37:20 +01:00
feat: Use xorriso to extract legacy ISO boot images (#1881)
This commit is contained in:
+20
-17
@@ -1776,36 +1776,39 @@ prepareLegacy() {
|
|||||||
local dir="$2"
|
local dir="$2"
|
||||||
local desc="$3"
|
local desc="$3"
|
||||||
|
|
||||||
|
local tmp="$TMP/boot-images"
|
||||||
|
local image="$tmp/eltorito_img1_bios.img"
|
||||||
|
|
||||||
ETFS="boot.img"
|
ETFS="boot.img"
|
||||||
|
|
||||||
[ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0
|
[ -s "$dir/$ETFS" ] && return 0
|
||||||
rm -f "$dir/$ETFS"
|
rm -f "$dir/$ETFS"
|
||||||
|
rm -rf "$tmp"
|
||||||
|
|
||||||
local len offset
|
if ! LC_ALL=C xorriso \
|
||||||
|
-no_rc \
|
||||||
if ! len=$(isoinfo -d -i "$iso" | grep "Nsect " | grep -o "[^ ]*$"); then
|
-osirrox on \
|
||||||
error "Failed to determine boot image size from $desc ISO!"
|
-indev "$iso" \
|
||||||
|
-extract_boot_images "$tmp" >/dev/null 2>&1; then
|
||||||
|
rm -rf "$tmp"
|
||||||
|
error "Failed to extract boot image from $desc ISO!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! offset=$(isoinfo -d -i "$iso" | grep "Bootoff " | grep -o "[^ ]*$"); then
|
if [ ! -s "$image" ]; then
|
||||||
error "Failed to determine boot image offset from $desc ISO!"
|
rm -rf "$tmp"
|
||||||
|
error "Failed to locate BIOS boot image in $desc ISO!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! "$len" =~ ^[0-9]+$ ]] || [[ ! "$offset" =~ ^[0-9]+$ ]]; then
|
if ! mv -f "$image" "$dir/$ETFS"; then
|
||||||
error "Invalid boot image location found in $desc ISO!"
|
rm -rf "$tmp"
|
||||||
|
error "Failed to save boot image from $desc ISO!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! dd "if=$iso" "of=$dir/$ETFS" bs=2048 "count=$len" "skip=$offset" status=none; then
|
rm -rf "$tmp"
|
||||||
error "Failed to extract boot image from $desc ISO!" && return 1
|
return 0
|
||||||
fi
|
|
||||||
|
|
||||||
[ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0
|
|
||||||
|
|
||||||
error "Failed to locate file \"$ETFS\" in $desc ISO image!"
|
|
||||||
return 1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
detectLegacy() {
|
detectLegacy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user