feat: Improve error handling during image detection (#1813)

This commit is contained in:
Kroese
2026-07-07 01:30:10 +02:00
committed by GitHub
parent 075b6bc97f
commit 8ad66b62a8
+11 -2
View File
@@ -832,7 +832,11 @@ detectImage() {
warn "failed to locate 'install.wim' or 'install.esd' in ISO image, $FB" && return 1
fi
info=$(wimlib-imagex info -xml "$wim" | iconv -f UTF-16LE -t UTF-8)
if ! info=$(wimlib-imagex info -xml "$wim" | iconv -f UTF-16LE -t UTF-8); then
warn "failed to read Windows image information, $FB"
return 1
fi
checkPlatform "$info" || exit 67
DETECTED=$(detectVersion "$info")
@@ -1122,7 +1126,12 @@ updateImage() {
fi
index="1"
result=$(wimlib-imagex info -xml "$wim" | iconv -f UTF-16LE -t UTF-8)
if ! result=$(wimlib-imagex info -xml "$wim" | iconv -f UTF-16LE -t UTF-8); then
warn "failed to read boot image information, $FB"
MANUAL="Y"
result=""
fi
if [[ "${result^^}" == *"<IMAGE INDEX=\"2\">"* ]]; then
index="2"