fix: Detection of EFI images (#577)

This commit is contained in:
Kroese 2024-06-09 23:17:42 +02:00 committed by GitHub
parent 0bb55b7bc1
commit 2f5f01dbb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 37 additions and 29 deletions

View File

@ -446,7 +446,7 @@ printEdition() {
;;
esac
[ -n "$edition" ] && result="$result $edition"
[ -n "$edition" ] && result+=" $edition"
echo "$result"
return 0
@ -729,13 +729,13 @@ getLink1() {
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
size=4821989376
sum="e8f1431c4e6289b3997c20eadbb2576670300bb6e1cf8948b5d7af179010a962"
url="26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
url="11/26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
;;
"win11x64-ltsc" | "win11x64-enterprise-ltsc-eval" )
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
size=4821989376
sum="e8f1431c4e6289b3997c20eadbb2576670300bb6e1cf8948b5d7af179010a962"
url="26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
url="11/26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_x64FRE_en-us.iso"
;;
"win10x64" | "win10x64-enterprise" | "win10x64-enterprise-eval" )
size=5675616256

View File

@ -23,7 +23,8 @@ cd /run
trap - ERR
info "Booting ${APP}${BOOT_DESC}..."
version=$(qemu-system-x86_64 --version | head -n 1 | cut -d '(' -f 1 | awk '{ print $NF }')
info "Booting ${APP}${BOOT_DESC} using QEMU v$version..."
{ qemu-system-x86_64 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || :
(( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15

View File

@ -167,10 +167,13 @@ abortInstall() {
local dir="$1"
local iso="$2"
local efi
[[ "${iso,,}" == *".esd" ]] && exit 60
if [ ! -d "$dir/EFI" ]; then
efi=$(find "$dir" -maxdepth 1 -type d -iname efi | head -n 1)
if [ -z "$efi" ]; then
[[ "${PLATFORM,,}" == "x64" ]] && BOOT_MODE="windows_legacy"
fi
@ -557,7 +560,7 @@ detectImage() {
if [[ "${LANGUAGE,,}" != "en" ]] && [[ "${LANGUAGE,,}" != "en-"* ]]; then
language=$(getLanguage "$LANGUAGE" "desc")
desc="$desc ($language)"
desc=+" ($language)"
fi
info "Detected: $desc"
@ -669,7 +672,7 @@ addDriver() {
"win81x64"* ) folder="w8.1/amd64" ;;
"win10x64"* ) folder="w10/amd64" ;;
"win11x64"* ) folder="w11/amd64" ;;
"win2025"* ) folder="2k22/amd64" ;;
"win2025"* ) folder="w11/amd64" ;;
"win2022"* ) folder="2k22/amd64" ;;
"win2019"* ) folder="2k19/amd64" ;;
"win2016"* ) folder="2k16/amd64" ;;

View File

@ -85,7 +85,7 @@ download_windows() {
local url="https://www.microsoft.com/en-us/software-download/windows$windows_version"
case "$windows_version" in
8 | 10) url="${url}ISO";;
8 | 10) url+="ISO";;
esac
# uuidgen: For MacOS (installed by default) and other systems (e.g. with no /proc) that don't have a kernel interface for generating random UUIDs
@ -416,8 +416,11 @@ getESD() {
local fFile="products_filter.xml"
{ wget "$winCatalog" -O "$dir/$wFile" -q --timeout=30; rc=$?; } || :
(( rc == 4 )) && error "Failed to download $winCatalog , network failure!" && return 1
(( rc != 0 )) && error "Failed to download $winCatalog , reason: $rc" && return 1
msg="Failed to download $winCatalog"
(( rc == 4 )) && error "$msg , network failure!" && return 1
(( rc == 8 )) && error "$msg , server issued an error response!" && return 1
(( rc != 0 )) && error "$msg , reason: $rc" && return 1
cd "$dir"
@ -495,8 +498,6 @@ verifyFile() {
fi
error "The downloaded file has an invalid $algo checksum: $hash , while expected value was: $check. Please report this at $SUPPORT/issues"
rm -f "$iso"
return 1
}
@ -519,19 +520,19 @@ downloadFile() {
progress="--progress=dot:giga"
fi
local msg="Downloading $desc..."
html "$msg"
local msg="Downloading $desc"
html "$msg..."
domain=$(echo "$url" | awk -F/ '{print $3}')
dots=$(echo "$domain" | tr -cd '.' | wc -c)
(( dots > 1 )) && domain=$(expr "$domain" : '.*\.\(.*\..*\)')
if [ -n "$domain" ] && [[ "${domain,,}" != *"microsoft.com" ]]; then
msg="Downloading $desc from $domain..."
msg="Downloading $desc from $domain"
fi
info "$msg"
/run/progress.sh "$iso" "$size" "Downloading $desc ([P])..." &
info "$msg..."
/run/progress.sh "$iso" "$size" "$msg ([P])..." &
{ wget "$url" -O "$iso" -q --timeout=30 --show-progress "$progress"; rc=$?; } || :
@ -539,19 +540,18 @@ downloadFile() {
if (( rc == 0 )) && [ -f "$iso" ]; then
total=$(stat -c%s "$iso")
if [ "$total" -gt 100000000 ]; then
if [ "$total" -lt 100000000 ]; then
error "Downloaded ISO is only $total bytes?" && return 1
fi
! verifyFile "$iso" "$size" "$total" "$sum" && return 1
html "Download finished successfully..." && return 0
fi
fi
if (( rc != 4 )); then
error "Failed to download $url , reason: $rc"
else
error "Failed to download $url , network failure!"
fi
msg="Failed to download $url"
(( rc == 4 )) && error "$msg , network failure!" && return 1
(( rc == 8 )) && error "$msg , server issued an error response!" && return 1
rm -f "$iso"
error "$msg , reason: $rc"
return 1
}
@ -567,6 +567,7 @@ downloadImage() {
base=$(basename "$iso")
desc=$(fromFile "$base")
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
rm -f "$iso"
return 1
fi
@ -582,7 +583,7 @@ downloadImage() {
desc=$(printEdition "$version" "$desc")
error "The $language language version of $desc is not available, please switch to English." && return 1
fi
desc="$desc in $language"
desc+=" in $language"
fi
if isMido "$version" "$lang"; then
@ -591,6 +592,7 @@ downloadImage() {
size=$(getMido "$version" "$lang" "size" )
sum=$(getMido "$version" "$lang" "sum")
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
rm -f "$iso"
fi
fi
@ -607,6 +609,7 @@ downloadImage() {
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
ISO="${ISO%.*}.esd"
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
rm -f "$ISO"
ISO="$iso"
fi
@ -624,6 +627,7 @@ downloadImage() {
size=$(getSize "$i" "$version" "$lang")
sum=$(getHash "$i" "$version" "$lang")
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
rm -f "$iso"
fi
done

View File

@ -216,7 +216,7 @@ _graceful_shutdown() {
SERIAL="pty"
MONITOR="telnet:localhost:$QEMU_PORT,server,nowait,nodelay"
MONITOR="$MONITOR -daemonize -D $QEMU_LOG -pidfile $QEMU_PID"
MONITOR+=" -daemonize -D $QEMU_LOG -pidfile $QEMU_PID"
_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT