diff --git a/src/image.sh b/src/image.sh index c62b7d2f..777411c1 100644 --- a/src/image.sh +++ b/src/image.sh @@ -1373,7 +1373,7 @@ detectIsoImage() { image=$(findIsoImage "$iso") || 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..." detectImageInfo "$image_info" || return 2 @@ -1838,6 +1838,7 @@ getBootLoadSize() { local boot_info size value case "${DETECTED,,}" in + "win2k"* | "winxp"* | "win2003"* ) # NT 5.x media may not expose a reliable catalog sector count, so derive @@ -1874,16 +1875,13 @@ getBootLoadSize() { return 1 fi - if [[ "$value" =~ ^[[:digit:]]{1,5}$ ]]; 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 + if [[ ! "$value" =~ ^[[:xdigit:]]{1,4}$ ]]; then error "Invalid boot image load size found in $desc ISO!" return 1 - fi ;; + fi + + BOOT_LOAD_SIZE=$((16#$value)) ;; + esac if (( BOOT_LOAD_SIZE < 1 || BOOT_LOAD_SIZE > 65535 )); then diff --git a/src/install.sh b/src/install.sh index b0a0623b..602aa4e2 100644 --- a/src/install.sh +++ b/src/install.sh @@ -75,6 +75,10 @@ selectWindowsImage() { return 0 fi + if (( detect_rc >= 129 )); then + return "$detect_rc" + fi + # Only code 1 indicates that extraction may recover detection. if (( detect_rc != 1 )); then skipUnattended "$dir" "$iso" "$boot" || return 76 @@ -88,12 +92,20 @@ selectWindowsImage() { fi extracted=1 + detect_rc=0 - if detectImage "$dir"; then + detectImage "$dir" || detect_rc=$? + + if (( detect_rc == 0 )); then return 0 fi + if (( detect_rc >= 129 )); then + return "$detect_rc" + fi + skipUnattended "$dir" "$iso" "$boot" || return 76 + handled=1 return 0 } @@ -832,7 +844,7 @@ detectImage() { wim=$(findImage "$dir") || return 1 local image_info - image_info=$(readImageInfo "$wim") || return 1 + image_info=$(readImageInfo "$wim") || return $? detectImageInfo "$image_info" }