mirror of
https://github.com/dockur/windows.git
synced 2026-08-03 20:47:12 +01:00
fix: Derive NT5 boot load size from extracted image (#1991)
This commit is contained in:
+26
-16
@@ -1044,18 +1044,34 @@ EOC
|
|||||||
getBootLoadSize() {
|
getBootLoadSize() {
|
||||||
|
|
||||||
local iso="$1"
|
local iso="$1"
|
||||||
local desc="$2"
|
local dir="$2"
|
||||||
local boot_info value
|
local desc="$3"
|
||||||
|
local boot_info size value
|
||||||
if ! boot_info=$(isoinfo -d -i "$iso"); then
|
|
||||||
|
|
||||||
case "${DETECTED,,}" in
|
case "${DETECTED,,}" in
|
||||||
"win2k"* | "winxp"* | "win2003"* )
|
"win2k"* | "winxp"* | "win2003"* )
|
||||||
BOOT_LOAD_SIZE=4
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
if [ ! -s "$dir/$ETFS" ]; then
|
||||||
|
error "Failed to locate file \"$ETFS\" in $desc ISO image!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! size=$(stat -c%s "$dir/$ETFS"); then
|
||||||
|
error "Failed to determine boot image size from $desc ISO!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if (( size < 512 || size % 512 != 0 )); then
|
||||||
|
error "Invalid boot image size found in $desc ISO!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
BOOT_LOAD_SIZE=$((size / 512))
|
||||||
|
;;
|
||||||
|
|
||||||
|
* )
|
||||||
|
|
||||||
|
if ! boot_info=$(isoinfo -d -i "$iso"); then
|
||||||
error "Failed to read boot image information from $desc ISO!"
|
error "Failed to read boot image information from $desc ISO!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -1063,14 +1079,6 @@ getBootLoadSize() {
|
|||||||
value=$(awk '/Nsect / { print $NF; exit }' <<< "$boot_info")
|
value=$(awk '/Nsect / { print $NF; exit }' <<< "$boot_info")
|
||||||
|
|
||||||
if [ -z "$value" ]; then
|
if [ -z "$value" ]; then
|
||||||
|
|
||||||
case "${DETECTED,,}" in
|
|
||||||
"win2k"* | "winxp"* | "win2003"* )
|
|
||||||
BOOT_LOAD_SIZE=4
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
error "Failed to determine boot image load size from $desc ISO!"
|
error "Failed to determine boot image load size from $desc ISO!"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -1081,6 +1089,8 @@ getBootLoadSize() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
BOOT_LOAD_SIZE=$((10#$value))
|
BOOT_LOAD_SIZE=$((10#$value))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if (( BOOT_LOAD_SIZE < 1 || BOOT_LOAD_SIZE > 65535 )); then
|
if (( BOOT_LOAD_SIZE < 1 || BOOT_LOAD_SIZE > 65535 )); then
|
||||||
error "Invalid boot image load size found in $desc ISO!"
|
error "Invalid boot image load size found in $desc ISO!"
|
||||||
|
|||||||
+1
-1
@@ -784,7 +784,7 @@ prepareImage() {
|
|||||||
|
|
||||||
if [[ "${BOOT_MODE,,}" == "windows_legacy" &&
|
if [[ "${BOOT_MODE,,}" == "windows_legacy" &&
|
||||||
"${DETECTED,,}" != "win9"* ]]; then
|
"${DETECTED,,}" != "win9"* ]]; then
|
||||||
getBootLoadSize "$iso" "$desc" || return 1
|
getBootLoadSize "$iso" "$dir" "$desc" || return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
skipVersion "$DETECTED" && return 0
|
skipVersion "$DETECTED" && return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user