fix: Detection of EFI images (#577)
This commit is contained in:
parent
0bb55b7bc1
commit
2f5f01dbb2
@ -446,7 +446,7 @@ printEdition() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[ -n "$edition" ] && result="$result $edition"
|
[ -n "$edition" ] && result+=" $edition"
|
||||||
|
|
||||||
echo "$result"
|
echo "$result"
|
||||||
return 0
|
return 0
|
||||||
@ -729,13 +729,13 @@ getLink1() {
|
|||||||
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
|
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
|
||||||
size=4821989376
|
size=4821989376
|
||||||
sum="e8f1431c4e6289b3997c20eadbb2576670300bb6e1cf8948b5d7af179010a962"
|
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" )
|
"win11x64-ltsc" | "win11x64-enterprise-ltsc-eval" )
|
||||||
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
|
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
|
||||||
size=4821989376
|
size=4821989376
|
||||||
sum="e8f1431c4e6289b3997c20eadbb2576670300bb6e1cf8948b5d7af179010a962"
|
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" )
|
"win10x64" | "win10x64-enterprise" | "win10x64-enterprise-eval" )
|
||||||
size=5675616256
|
size=5675616256
|
||||||
@ -2158,7 +2158,7 @@ prepareInstall() {
|
|||||||
echo "\"LimitBlankPasswordUse\"=dword:00000000"
|
echo "\"LimitBlankPasswordUse\"=dword:00000000"
|
||||||
echo ""
|
echo ""
|
||||||
echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\srvWiz]"
|
echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\srvWiz]"
|
||||||
echo "@=dword:00000000"
|
echo "@=dword:00000000"
|
||||||
echo ""
|
echo ""
|
||||||
echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Tour]"
|
echo "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Tour]"
|
||||||
echo "\"RunCount\"=dword:00000000"
|
echo "\"RunCount\"=dword:00000000"
|
||||||
|
@ -23,7 +23,8 @@ cd /run
|
|||||||
|
|
||||||
trap - ERR
|
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=$?; } || :
|
{ qemu-system-x86_64 ${ARGS:+ $ARGS} >"$QEMU_OUT" 2>"$QEMU_LOG"; rc=$?; } || :
|
||||||
(( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15
|
(( rc != 0 )) && error "$(<"$QEMU_LOG")" && exit 15
|
||||||
|
@ -167,10 +167,13 @@ abortInstall() {
|
|||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local iso="$2"
|
local iso="$2"
|
||||||
|
local efi
|
||||||
|
|
||||||
[[ "${iso,,}" == *".esd" ]] && exit 60
|
[[ "${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"
|
[[ "${PLATFORM,,}" == "x64" ]] && BOOT_MODE="windows_legacy"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -557,7 +560,7 @@ detectImage() {
|
|||||||
|
|
||||||
if [[ "${LANGUAGE,,}" != "en" ]] && [[ "${LANGUAGE,,}" != "en-"* ]]; then
|
if [[ "${LANGUAGE,,}" != "en" ]] && [[ "${LANGUAGE,,}" != "en-"* ]]; then
|
||||||
language=$(getLanguage "$LANGUAGE" "desc")
|
language=$(getLanguage "$LANGUAGE" "desc")
|
||||||
desc="$desc ($language)"
|
desc=+" ($language)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "Detected: $desc"
|
info "Detected: $desc"
|
||||||
@ -669,7 +672,7 @@ addDriver() {
|
|||||||
"win81x64"* ) folder="w8.1/amd64" ;;
|
"win81x64"* ) folder="w8.1/amd64" ;;
|
||||||
"win10x64"* ) folder="w10/amd64" ;;
|
"win10x64"* ) folder="w10/amd64" ;;
|
||||||
"win11x64"* ) folder="w11/amd64" ;;
|
"win11x64"* ) folder="w11/amd64" ;;
|
||||||
"win2025"* ) folder="2k22/amd64" ;;
|
"win2025"* ) folder="w11/amd64" ;;
|
||||||
"win2022"* ) folder="2k22/amd64" ;;
|
"win2022"* ) folder="2k22/amd64" ;;
|
||||||
"win2019"* ) folder="2k19/amd64" ;;
|
"win2019"* ) folder="2k19/amd64" ;;
|
||||||
"win2016"* ) folder="2k16/amd64" ;;
|
"win2016"* ) folder="2k16/amd64" ;;
|
||||||
|
44
src/mido.sh
44
src/mido.sh
@ -85,7 +85,7 @@ download_windows() {
|
|||||||
|
|
||||||
local url="https://www.microsoft.com/en-us/software-download/windows$windows_version"
|
local url="https://www.microsoft.com/en-us/software-download/windows$windows_version"
|
||||||
case "$windows_version" in
|
case "$windows_version" in
|
||||||
8 | 10) url="${url}ISO";;
|
8 | 10) url+="ISO";;
|
||||||
esac
|
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
|
# 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"
|
local fFile="products_filter.xml"
|
||||||
|
|
||||||
{ wget "$winCatalog" -O "$dir/$wFile" -q --timeout=30; rc=$?; } || :
|
{ 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"
|
cd "$dir"
|
||||||
|
|
||||||
@ -495,8 +498,6 @@ verifyFile() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
error "The downloaded file has an invalid $algo checksum: $hash , while expected value was: $check. Please report this at $SUPPORT/issues"
|
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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,19 +520,19 @@ downloadFile() {
|
|||||||
progress="--progress=dot:giga"
|
progress="--progress=dot:giga"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local msg="Downloading $desc..."
|
local msg="Downloading $desc"
|
||||||
html "$msg"
|
html "$msg..."
|
||||||
|
|
||||||
domain=$(echo "$url" | awk -F/ '{print $3}')
|
domain=$(echo "$url" | awk -F/ '{print $3}')
|
||||||
dots=$(echo "$domain" | tr -cd '.' | wc -c)
|
dots=$(echo "$domain" | tr -cd '.' | wc -c)
|
||||||
(( dots > 1 )) && domain=$(expr "$domain" : '.*\.\(.*\..*\)')
|
(( dots > 1 )) && domain=$(expr "$domain" : '.*\.\(.*\..*\)')
|
||||||
|
|
||||||
if [ -n "$domain" ] && [[ "${domain,,}" != *"microsoft.com" ]]; then
|
if [ -n "$domain" ] && [[ "${domain,,}" != *"microsoft.com" ]]; then
|
||||||
msg="Downloading $desc from $domain..."
|
msg="Downloading $desc from $domain"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
info "$msg"
|
info "$msg..."
|
||||||
/run/progress.sh "$iso" "$size" "Downloading $desc ([P])..." &
|
/run/progress.sh "$iso" "$size" "$msg ([P])..." &
|
||||||
|
|
||||||
{ wget "$url" -O "$iso" -q --timeout=30 --show-progress "$progress"; rc=$?; } || :
|
{ wget "$url" -O "$iso" -q --timeout=30 --show-progress "$progress"; rc=$?; } || :
|
||||||
|
|
||||||
@ -539,19 +540,18 @@ downloadFile() {
|
|||||||
|
|
||||||
if (( rc == 0 )) && [ -f "$iso" ]; then
|
if (( rc == 0 )) && [ -f "$iso" ]; then
|
||||||
total=$(stat -c%s "$iso")
|
total=$(stat -c%s "$iso")
|
||||||
if [ "$total" -gt 100000000 ]; then
|
if [ "$total" -lt 100000000 ]; then
|
||||||
! verifyFile "$iso" "$size" "$total" "$sum" && return 1
|
error "Downloaded ISO is only $total bytes?" && return 1
|
||||||
html "Download finished successfully..." && return 0
|
|
||||||
fi
|
fi
|
||||||
|
! verifyFile "$iso" "$size" "$total" "$sum" && return 1
|
||||||
|
html "Download finished successfully..." && return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if (( rc != 4 )); then
|
msg="Failed to download $url"
|
||||||
error "Failed to download $url , reason: $rc"
|
(( rc == 4 )) && error "$msg , network failure!" && return 1
|
||||||
else
|
(( rc == 8 )) && error "$msg , server issued an error response!" && return 1
|
||||||
error "Failed to download $url , network failure!"
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f "$iso"
|
error "$msg , reason: $rc"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -567,6 +567,7 @@ downloadImage() {
|
|||||||
base=$(basename "$iso")
|
base=$(basename "$iso")
|
||||||
desc=$(fromFile "$base")
|
desc=$(fromFile "$base")
|
||||||
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
|
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
|
||||||
|
rm -f "$iso"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -582,7 +583,7 @@ downloadImage() {
|
|||||||
desc=$(printEdition "$version" "$desc")
|
desc=$(printEdition "$version" "$desc")
|
||||||
error "The $language language version of $desc is not available, please switch to English." && return 1
|
error "The $language language version of $desc is not available, please switch to English." && return 1
|
||||||
fi
|
fi
|
||||||
desc="$desc in $language"
|
desc+=" in $language"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if isMido "$version" "$lang"; then
|
if isMido "$version" "$lang"; then
|
||||||
@ -591,6 +592,7 @@ downloadImage() {
|
|||||||
size=$(getMido "$version" "$lang" "size" )
|
size=$(getMido "$version" "$lang" "size" )
|
||||||
sum=$(getMido "$version" "$lang" "sum")
|
sum=$(getMido "$version" "$lang" "sum")
|
||||||
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
|
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
|
||||||
|
rm -f "$iso"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -607,6 +609,7 @@ downloadImage() {
|
|||||||
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
|
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
|
||||||
ISO="${ISO%.*}.esd"
|
ISO="${ISO%.*}.esd"
|
||||||
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
|
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
|
||||||
|
rm -f "$ISO"
|
||||||
ISO="$iso"
|
ISO="$iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -624,6 +627,7 @@ downloadImage() {
|
|||||||
size=$(getSize "$i" "$version" "$lang")
|
size=$(getSize "$i" "$version" "$lang")
|
||||||
sum=$(getHash "$i" "$version" "$lang")
|
sum=$(getHash "$i" "$version" "$lang")
|
||||||
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
|
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
|
||||||
|
rm -f "$iso"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
@ -216,7 +216,7 @@ _graceful_shutdown() {
|
|||||||
|
|
||||||
SERIAL="pty"
|
SERIAL="pty"
|
||||||
MONITOR="telnet:localhost:$QEMU_PORT,server,nowait,nodelay"
|
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
|
_trap _graceful_shutdown SIGTERM SIGHUP SIGINT SIGABRT SIGQUIT
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user