mirror of
https://github.com/dockur/windows.git
synced 2026-08-24 15:48:59 +01:00
fix: Distinguish ISO read failures from missing payloads (#2105)
This commit is contained in:
+10
-3
@@ -926,6 +926,11 @@ findIsoImage() {
|
|||||||
local iso="$1"
|
local iso="$1"
|
||||||
local path
|
local path
|
||||||
|
|
||||||
|
# Verify that udfread can access the ISO before treating missing payload paths
|
||||||
|
# as a normal detection miss.
|
||||||
|
udfread stat --ignore-case "$iso" / >/dev/null 2>&1 || return 2
|
||||||
|
udfread stat --ignore-case "$iso" /sources >/dev/null 2>&1 || return 1
|
||||||
|
|
||||||
# Prefer install.wim when both payload forms are present.
|
# Prefer install.wim when both payload forms are present.
|
||||||
for path in /sources/install.wim /sources/install.esd; do
|
for path in /sources/install.wim /sources/install.esd; do
|
||||||
|
|
||||||
@@ -1199,13 +1204,15 @@ readImageInfo() {
|
|||||||
|
|
||||||
local wim="$1"
|
local wim="$1"
|
||||||
local result=""
|
local result=""
|
||||||
|
local msg="Failed to read Windows image information!"
|
||||||
|
|
||||||
if ! result=$(wimlib-imagex info --xml "$wim" | iconv -f UTF-16LE -t UTF-8); then
|
if ! result=$(wimlib-imagex info --xml "$wim" | iconv -f UTF-16LE -t UTF-8); then
|
||||||
result=""
|
error "$msg"
|
||||||
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$result" ]; then
|
if [ -z "$result" ]; then
|
||||||
error "Failed to read Windows image information!"
|
error "$msg"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1370,7 +1377,7 @@ detectIsoImage() {
|
|||||||
|
|
||||||
# Return 1 only when no directly inspectable WIM/ESD payload is available so
|
# Return 1 only when no directly inspectable WIM/ESD payload is available so
|
||||||
# the caller may extract the media. Metadata parsing/configuration errors use 2.
|
# the caller may extract the media. Metadata parsing/configuration errors use 2.
|
||||||
image=$(findIsoImage "$iso") || return 1
|
image=$(findIsoImage "$iso") || return
|
||||||
header=$(readWimHeader "$iso" "$image") || return 2
|
header=$(readWimHeader "$iso" "$image") || return 2
|
||||||
|
|
||||||
image_info=$(readIsoImageInfo "$iso" "$image" "$header") || return 2
|
image_info=$(readIsoImageInfo "$iso" "$image" "$header") || return 2
|
||||||
|
|||||||
Reference in New Issue
Block a user