mirror of
https://github.com/dockur/windows.git
synced 2026-08-24 15:48:59 +01:00
fix: Preserve signal exits during image detection (#2075)
This commit is contained in:
+7
-9
@@ -1373,7 +1373,7 @@ detectIsoImage() {
|
|||||||
|
|
||||||
image=$(findIsoImage "$iso") || return 1
|
image=$(findIsoImage "$iso") || return 1
|
||||||
header=$(readWimHeader "$iso" "$image") || return 1
|
header=$(readWimHeader "$iso" "$image") || return 1
|
||||||
image_info=$(readIsoImageInfo "$iso" "$image" "$header") || return 1
|
image_info=$(readIsoImageInfo "$iso" "$image" "$header") || return $?
|
||||||
|
|
||||||
info "Detecting version from ISO image..."
|
info "Detecting version from ISO image..."
|
||||||
detectImageInfo "$image_info" || return 2
|
detectImageInfo "$image_info" || return 2
|
||||||
@@ -1838,6 +1838,7 @@ getBootLoadSize() {
|
|||||||
local boot_info size value
|
local boot_info size value
|
||||||
|
|
||||||
case "${DETECTED,,}" in
|
case "${DETECTED,,}" in
|
||||||
|
|
||||||
"win2k"* | "winxp"* | "win2003"* )
|
"win2k"* | "winxp"* | "win2003"* )
|
||||||
|
|
||||||
# NT 5.x media may not expose a reliable catalog sector count, so derive
|
# NT 5.x media may not expose a reliable catalog sector count, so derive
|
||||||
@@ -1874,16 +1875,13 @@ getBootLoadSize() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$value" =~ ^[[:digit:]]{1,5}$ ]]; then
|
if [[ ! "$value" =~ ^[[:xdigit:]]{1,4}$ ]]; then
|
||||||
BOOT_LOAD_SIZE=$((10#$value))
|
|
||||||
elif [[ "$value" =~ ^(0[xX])?[[:xdigit:]]{1,4}$ ]]; then
|
|
||||||
value=${value#0x}
|
|
||||||
value=${value#0X}
|
|
||||||
BOOT_LOAD_SIZE=$((16#$value))
|
|
||||||
else
|
|
||||||
error "Invalid boot image load size found in $desc ISO!"
|
error "Invalid boot image load size found in $desc ISO!"
|
||||||
return 1
|
return 1
|
||||||
fi ;;
|
fi
|
||||||
|
|
||||||
|
BOOT_LOAD_SIZE=$((16#$value)) ;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if (( BOOT_LOAD_SIZE < 1 || BOOT_LOAD_SIZE > 65535 )); then
|
if (( BOOT_LOAD_SIZE < 1 || BOOT_LOAD_SIZE > 65535 )); then
|
||||||
|
|||||||
+14
-2
@@ -75,6 +75,10 @@ selectWindowsImage() {
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if (( detect_rc >= 129 )); then
|
||||||
|
return "$detect_rc"
|
||||||
|
fi
|
||||||
|
|
||||||
# Only code 1 indicates that extraction may recover detection.
|
# Only code 1 indicates that extraction may recover detection.
|
||||||
if (( detect_rc != 1 )); then
|
if (( detect_rc != 1 )); then
|
||||||
skipUnattended "$dir" "$iso" "$boot" || return 76
|
skipUnattended "$dir" "$iso" "$boot" || return 76
|
||||||
@@ -88,12 +92,20 @@ selectWindowsImage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
extracted=1
|
extracted=1
|
||||||
|
detect_rc=0
|
||||||
|
|
||||||
if detectImage "$dir"; then
|
detectImage "$dir" || detect_rc=$?
|
||||||
|
|
||||||
|
if (( detect_rc == 0 )); then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if (( detect_rc >= 129 )); then
|
||||||
|
return "$detect_rc"
|
||||||
|
fi
|
||||||
|
|
||||||
skipUnattended "$dir" "$iso" "$boot" || return 76
|
skipUnattended "$dir" "$iso" "$boot" || return 76
|
||||||
|
|
||||||
handled=1
|
handled=1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@@ -832,7 +844,7 @@ detectImage() {
|
|||||||
wim=$(findImage "$dir") || return 1
|
wim=$(findImage "$dir") || return 1
|
||||||
|
|
||||||
local image_info
|
local image_info
|
||||||
image_info=$(readImageInfo "$wim") || return 1
|
image_info=$(readImageInfo "$wim") || return $?
|
||||||
|
|
||||||
detectImageInfo "$image_info"
|
detectImageInfo "$image_info"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user