From 9c08dc7b1e7d3f78f0ef7f40a73e09e968a8a8b0 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 21 Sep 2025 15:15:46 +0200 Subject: [PATCH 1/6] fix: Simplify conditional checks (#1413) --- src/define.sh | 10 +++++----- src/install.sh | 36 ++++++++++++++++++------------------ src/power.sh | 2 +- src/samba.sh | 6 +++--- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/define.sh b/src/define.sh index 31df027..efc8c53 100644 --- a/src/define.sh +++ b/src/define.sh @@ -1269,7 +1269,7 @@ getValue() { local type="$4" local func="getLink$1" - if [ "$1" -gt 0 ] && [ "$1" -le "$MIRRORS" ]; then + if [ "$1" -gt 0 && "$1" -le "$MIRRORS" ]; then val=$($func "$id" "$lang" "$type") fi @@ -1394,7 +1394,7 @@ prepareInstall() { ETFS="[BOOT]/Boot-NoEmul.img" - if [ ! -f "$dir/$ETFS" ] || [ ! -s "$dir/$ETFS" ]; then + if [ ! -f "$dir/$ETFS" || ! -s "$dir/$ETFS" ]; then error "Failed to locate file \"$ETFS\" in $desc ISO image!" && return 1 fi @@ -1478,7 +1478,7 @@ prepareInstall() { local key setup setup=$(find "$target" -maxdepth 1 -type f -iname setupp.ini -print -quit) - if [ -n "$setup" ] && [ -z "$KEY" ]; then + if [ -n "$setup" & -z "$KEY" ]; then pid=$(<"$setup") pid="${pid%$'\r'}" @@ -1795,7 +1795,7 @@ prepareLegacy() { ETFS="boot.img" - [ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0 + [ -f "$dir/$ETFS" && -s "$dir/$ETFS" ] && return 0 rm -f "$dir/$ETFS" local len offset @@ -1806,7 +1806,7 @@ prepareLegacy() { error "Failed to extract boot image from $desc ISO!" && return 1 fi - [ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0 + [ -f "$dir/$ETFS" && -s "$dir/$ETFS" ] && return 0 error "Failed to locate file \"$ETFS\" in $desc ISO image!" return 1 diff --git a/src/install.sh b/src/install.sh index 084bbd2..a490479 100644 --- a/src/install.sh +++ b/src/install.sh @@ -162,7 +162,7 @@ startInstall() { ISO=$(basename "$BOOT") ISO="$TMP/$ISO" - if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then + if [ -f "$BOOT" && -s "$BOOT" ]; then mv -f "$BOOT" "$ISO" fi @@ -183,7 +183,7 @@ finishInstall() { local aborted="$2" local base byte - if [ ! -s "$iso" ] || [ ! -f "$iso" ]; then + if [ ! -s "$iso" || ! -f "$iso" ]; then error "Failed to find ISO file: $iso" && return 1 fi @@ -304,7 +304,7 @@ findFile() { file="$STORAGE/$base" fi - if [ ! -f "$file" ] || [ ! -s "$file" ]; then + if [ ! -f "$file" || ! -s "$file" ]; then return 0 fi @@ -621,11 +621,11 @@ setXML() { error "The bind $file maps to a file that does not exist!" && exit 67 fi - [ ! -f "$file" ] || [ ! -s "$file" ] && file="$STORAGE/custom.xml" - [ ! -f "$file" ] || [ ! -s "$file" ] && file="/run/assets/custom.xml" - [ ! -f "$file" ] || [ ! -s "$file" ] && file="$1" - [ ! -f "$file" ] || [ ! -s "$file" ] && file="/run/assets/$DETECTED.xml" - [ ! -f "$file" ] || [ ! -s "$file" ] && return 1 + [ ! -f "$file" || ! -s "$file" ] && file="$STORAGE/custom.xml" + [ ! -f "$file" || ! -s "$file" ] && file="/run/assets/custom.xml" + [ ! -f "$file" || ! -s "$file" ] && file="$1" + [ ! -f "$file" || ! -s "$file" ] && file="/run/assets/$DETECTED.xml" + [ ! -f "$file" || ! -s "$file" ] && return 1 XML="$file" return 0 @@ -639,7 +639,7 @@ detectImage() { XML="" - if [ -z "$DETECTED" ] && [ -z "$CUSTOM" ]; then + if [ -z "$DETECTED" && -z "$CUSTOM" ]; then [[ "${version,,}" != "http"* ]] && DETECTED="$version" fi @@ -734,7 +734,7 @@ prepareImage() { if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then - [ -f "$dir/$ETFS" ] && [ -f "$dir/$EFISYS" ] && return 0 + [ -f "$dir/$ETFS" && -f "$dir/$EFISYS" ] && return 0 missing=$(basename "$dir/$EFISYS") [ ! -f "$dir/$ETFS" ] && missing=$(basename "$dir/$ETFS") @@ -955,7 +955,7 @@ updateImage() { skipVersion "${DETECTED,,}" && return 0 - if [ ! -s "$asset" ] || [ ! -f "$asset" ]; then + if [ ! -s "$asset" || ! -f "$asset" ]; then asset="" if [[ "$MANUAL" != [Yy1]* ]]; then MANUAL="Y" @@ -1140,40 +1140,40 @@ bootWindows() { ARGUMENTS="$ARGS ${ARGUMENTS:-}" fi - if [ -s "$STORAGE/windows.vga" ] && [ -f "$STORAGE/windows.vga" ]; then + if [ -s "$STORAGE/windows.vga" && -f "$STORAGE/windows.vga" ]; then if [ -z "${VGA:-}" ]; then VGA=$(<"$STORAGE/windows.vga") VGA="${VGA//[![:print:]]/}" fi fi - if [ -s "$STORAGE/windows.usb" ] && [ -f "$STORAGE/windows.usb" ]; then + if [ -s "$STORAGE/windows.usb" && -f "$STORAGE/windows.usb" ]; then if [ -z "${USB:-}" ]; then USB=$(<"$STORAGE/windows.usb") USB="${USB//[![:print:]]/}" fi fi - if [ -s "$STORAGE/windows.net" ] && [ -f "$STORAGE/windows.net" ]; then + if [ -s "$STORAGE/windows.net" && -f "$STORAGE/windows.net" ]; then if [ -z "${ADAPTER:-}" ]; then ADAPTER=$(<"$STORAGE/windows.net") ADAPTER="${ADAPTER//[![:print:]]/}" fi fi - if [ -s "$STORAGE/windows.type" ] && [ -f "$STORAGE/windows.type" ]; then + if [ -s "$STORAGE/windows.type" && -f "$STORAGE/windows.type" ]; then if [ -z "${DISK_TYPE:-}" ]; then DISK_TYPE=$(<"$STORAGE/windows.type") DISK_TYPE="${DISK_TYPE//[![:print:]]/}" fi fi - if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then + if [ -s "$STORAGE/windows.mode" && -f "$STORAGE/windows.mode" ]; then BOOT_MODE=$(<"$STORAGE/windows.mode") BOOT_MODE="${BOOT_MODE//[![:print:]]/}" fi - if [ -s "$STORAGE/windows.old" ] && [ -f "$STORAGE/windows.old" ]; then + if [ -s "$STORAGE/windows.old" && -f "$STORAGE/windows.old" ]; then if [[ "${PLATFORM,,}" == "x64" ]]; then MACHINE=$(<"$STORAGE/windows.old") MACHINE="${MACHINE//[![:print:]]/}" @@ -1194,7 +1194,7 @@ if ! startInstall; then exit 68 fi -if [ ! -s "$ISO" ] || [ ! -f "$ISO" ]; then +if [ ! -s "$ISO" || ! -f "$ISO" ]; then if ! downloadImage "$ISO" "$VERSION" "$LANGUAGE"; then rm -f "$ISO" 2> /dev/null || true exit 61 diff --git a/src/power.sh b/src/power.sh index 9ca5583..7b3fb2d 100644 --- a/src/power.sh +++ b/src/power.sh @@ -91,7 +91,7 @@ finish() { done fi - if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$BOOT" ]; then + if [ ! -f "$STORAGE/windows.boot" && -f "$BOOT" ]; then # Remove CD-ROM ISO after install if ready; then touch "$STORAGE/windows.boot" diff --git a/src/samba.sh b/src/samba.sh index e5b4442..77a3eb5 100644 --- a/src/samba.sh +++ b/src/samba.sh @@ -88,9 +88,9 @@ addShare() { } > "/etc/samba/smb.conf" share="/data" -[ ! -d "$share" ] && [ -d "$STORAGE/data" ] && share="$STORAGE/data" -[ ! -d "$share" ] && [ -d "/shared" ] && share="/shared" -[ ! -d "$share" ] && [ -d "$STORAGE/shared" ] && share="$STORAGE/shared" +[ ! -d "$share" && -d "$STORAGE/data" ] && share="$STORAGE/data" +[ ! -d "$share" && -d "/shared" ] && share="/shared" +[ ! -d "$share" && -d "$STORAGE/shared" ] && share="$STORAGE/shared" if ! addShare "$share" "Data" "Shared"; then error "Failed to add shared folder '$share'. Please check its permissions." && return 0 From 0f918c8cb0cad13aa4b4afb07e11f64b573c50e3 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 21 Sep 2025 23:04:29 +0200 Subject: [PATCH 2/6] revert: Simplify conditional checks (#1414) This reverts commit 9c08dc7b1e7d3f78f0ef7f40a73e09e968a8a8b0. --- src/define.sh | 10 +++++----- src/install.sh | 36 ++++++++++++++++++------------------ src/power.sh | 2 +- src/samba.sh | 6 +++--- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/define.sh b/src/define.sh index efc8c53..31df027 100644 --- a/src/define.sh +++ b/src/define.sh @@ -1269,7 +1269,7 @@ getValue() { local type="$4" local func="getLink$1" - if [ "$1" -gt 0 && "$1" -le "$MIRRORS" ]; then + if [ "$1" -gt 0 ] && [ "$1" -le "$MIRRORS" ]; then val=$($func "$id" "$lang" "$type") fi @@ -1394,7 +1394,7 @@ prepareInstall() { ETFS="[BOOT]/Boot-NoEmul.img" - if [ ! -f "$dir/$ETFS" || ! -s "$dir/$ETFS" ]; then + if [ ! -f "$dir/$ETFS" ] || [ ! -s "$dir/$ETFS" ]; then error "Failed to locate file \"$ETFS\" in $desc ISO image!" && return 1 fi @@ -1478,7 +1478,7 @@ prepareInstall() { local key setup setup=$(find "$target" -maxdepth 1 -type f -iname setupp.ini -print -quit) - if [ -n "$setup" & -z "$KEY" ]; then + if [ -n "$setup" ] && [ -z "$KEY" ]; then pid=$(<"$setup") pid="${pid%$'\r'}" @@ -1795,7 +1795,7 @@ prepareLegacy() { ETFS="boot.img" - [ -f "$dir/$ETFS" && -s "$dir/$ETFS" ] && return 0 + [ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0 rm -f "$dir/$ETFS" local len offset @@ -1806,7 +1806,7 @@ prepareLegacy() { error "Failed to extract boot image from $desc ISO!" && return 1 fi - [ -f "$dir/$ETFS" && -s "$dir/$ETFS" ] && return 0 + [ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0 error "Failed to locate file \"$ETFS\" in $desc ISO image!" return 1 diff --git a/src/install.sh b/src/install.sh index a490479..084bbd2 100644 --- a/src/install.sh +++ b/src/install.sh @@ -162,7 +162,7 @@ startInstall() { ISO=$(basename "$BOOT") ISO="$TMP/$ISO" - if [ -f "$BOOT" && -s "$BOOT" ]; then + if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then mv -f "$BOOT" "$ISO" fi @@ -183,7 +183,7 @@ finishInstall() { local aborted="$2" local base byte - if [ ! -s "$iso" || ! -f "$iso" ]; then + if [ ! -s "$iso" ] || [ ! -f "$iso" ]; then error "Failed to find ISO file: $iso" && return 1 fi @@ -304,7 +304,7 @@ findFile() { file="$STORAGE/$base" fi - if [ ! -f "$file" || ! -s "$file" ]; then + if [ ! -f "$file" ] || [ ! -s "$file" ]; then return 0 fi @@ -621,11 +621,11 @@ setXML() { error "The bind $file maps to a file that does not exist!" && exit 67 fi - [ ! -f "$file" || ! -s "$file" ] && file="$STORAGE/custom.xml" - [ ! -f "$file" || ! -s "$file" ] && file="/run/assets/custom.xml" - [ ! -f "$file" || ! -s "$file" ] && file="$1" - [ ! -f "$file" || ! -s "$file" ] && file="/run/assets/$DETECTED.xml" - [ ! -f "$file" || ! -s "$file" ] && return 1 + [ ! -f "$file" ] || [ ! -s "$file" ] && file="$STORAGE/custom.xml" + [ ! -f "$file" ] || [ ! -s "$file" ] && file="/run/assets/custom.xml" + [ ! -f "$file" ] || [ ! -s "$file" ] && file="$1" + [ ! -f "$file" ] || [ ! -s "$file" ] && file="/run/assets/$DETECTED.xml" + [ ! -f "$file" ] || [ ! -s "$file" ] && return 1 XML="$file" return 0 @@ -639,7 +639,7 @@ detectImage() { XML="" - if [ -z "$DETECTED" && -z "$CUSTOM" ]; then + if [ -z "$DETECTED" ] && [ -z "$CUSTOM" ]; then [[ "${version,,}" != "http"* ]] && DETECTED="$version" fi @@ -734,7 +734,7 @@ prepareImage() { if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then - [ -f "$dir/$ETFS" && -f "$dir/$EFISYS" ] && return 0 + [ -f "$dir/$ETFS" ] && [ -f "$dir/$EFISYS" ] && return 0 missing=$(basename "$dir/$EFISYS") [ ! -f "$dir/$ETFS" ] && missing=$(basename "$dir/$ETFS") @@ -955,7 +955,7 @@ updateImage() { skipVersion "${DETECTED,,}" && return 0 - if [ ! -s "$asset" || ! -f "$asset" ]; then + if [ ! -s "$asset" ] || [ ! -f "$asset" ]; then asset="" if [[ "$MANUAL" != [Yy1]* ]]; then MANUAL="Y" @@ -1140,40 +1140,40 @@ bootWindows() { ARGUMENTS="$ARGS ${ARGUMENTS:-}" fi - if [ -s "$STORAGE/windows.vga" && -f "$STORAGE/windows.vga" ]; then + if [ -s "$STORAGE/windows.vga" ] && [ -f "$STORAGE/windows.vga" ]; then if [ -z "${VGA:-}" ]; then VGA=$(<"$STORAGE/windows.vga") VGA="${VGA//[![:print:]]/}" fi fi - if [ -s "$STORAGE/windows.usb" && -f "$STORAGE/windows.usb" ]; then + if [ -s "$STORAGE/windows.usb" ] && [ -f "$STORAGE/windows.usb" ]; then if [ -z "${USB:-}" ]; then USB=$(<"$STORAGE/windows.usb") USB="${USB//[![:print:]]/}" fi fi - if [ -s "$STORAGE/windows.net" && -f "$STORAGE/windows.net" ]; then + if [ -s "$STORAGE/windows.net" ] && [ -f "$STORAGE/windows.net" ]; then if [ -z "${ADAPTER:-}" ]; then ADAPTER=$(<"$STORAGE/windows.net") ADAPTER="${ADAPTER//[![:print:]]/}" fi fi - if [ -s "$STORAGE/windows.type" && -f "$STORAGE/windows.type" ]; then + if [ -s "$STORAGE/windows.type" ] && [ -f "$STORAGE/windows.type" ]; then if [ -z "${DISK_TYPE:-}" ]; then DISK_TYPE=$(<"$STORAGE/windows.type") DISK_TYPE="${DISK_TYPE//[![:print:]]/}" fi fi - if [ -s "$STORAGE/windows.mode" && -f "$STORAGE/windows.mode" ]; then + if [ -s "$STORAGE/windows.mode" ] && [ -f "$STORAGE/windows.mode" ]; then BOOT_MODE=$(<"$STORAGE/windows.mode") BOOT_MODE="${BOOT_MODE//[![:print:]]/}" fi - if [ -s "$STORAGE/windows.old" && -f "$STORAGE/windows.old" ]; then + if [ -s "$STORAGE/windows.old" ] && [ -f "$STORAGE/windows.old" ]; then if [[ "${PLATFORM,,}" == "x64" ]]; then MACHINE=$(<"$STORAGE/windows.old") MACHINE="${MACHINE//[![:print:]]/}" @@ -1194,7 +1194,7 @@ if ! startInstall; then exit 68 fi -if [ ! -s "$ISO" || ! -f "$ISO" ]; then +if [ ! -s "$ISO" ] || [ ! -f "$ISO" ]; then if ! downloadImage "$ISO" "$VERSION" "$LANGUAGE"; then rm -f "$ISO" 2> /dev/null || true exit 61 diff --git a/src/power.sh b/src/power.sh index 7b3fb2d..9ca5583 100644 --- a/src/power.sh +++ b/src/power.sh @@ -91,7 +91,7 @@ finish() { done fi - if [ ! -f "$STORAGE/windows.boot" && -f "$BOOT" ]; then + if [ ! -f "$STORAGE/windows.boot" ] && [ -f "$BOOT" ]; then # Remove CD-ROM ISO after install if ready; then touch "$STORAGE/windows.boot" diff --git a/src/samba.sh b/src/samba.sh index 77a3eb5..e5b4442 100644 --- a/src/samba.sh +++ b/src/samba.sh @@ -88,9 +88,9 @@ addShare() { } > "/etc/samba/smb.conf" share="/data" -[ ! -d "$share" && -d "$STORAGE/data" ] && share="$STORAGE/data" -[ ! -d "$share" && -d "/shared" ] && share="/shared" -[ ! -d "$share" && -d "$STORAGE/shared" ] && share="$STORAGE/shared" +[ ! -d "$share" ] && [ -d "$STORAGE/data" ] && share="$STORAGE/data" +[ ! -d "$share" ] && [ -d "/shared" ] && share="/shared" +[ ! -d "$share" ] && [ -d "$STORAGE/shared" ] && share="$STORAGE/shared" if ! addShare "$share" "Data" "Shared"; then error "Failed to add shared folder '$share'. Please check its permissions." && return 0 From 4a5e455389c5bd07b793c7d11a0fb63e89e5e564 Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 22 Sep 2025 08:25:53 +0200 Subject: [PATCH 3/6] feat: Download older Windows 11 build on ARMv8.0 (#1416) --- src/define.sh | 4 +- src/mido.sh | 125 +++++++++++++++++++++++++++++++++++++------------- 2 files changed, 96 insertions(+), 33 deletions(-) diff --git a/src/define.sh b/src/define.sh index 31df027..62a6f9e 100644 --- a/src/define.sh +++ b/src/define.sh @@ -436,7 +436,7 @@ printVersion() { "tiny11"* ) desc="Tiny 11" ;; "tiny10"* ) desc="Tiny 10" ;; "core11"* ) desc="Core 11" ;; - "nano11"* ) desc="Nano 11" ;; + "nano11"* ) desc="Nano 11" ;; "win7"* ) desc="Windows 7" ;; "win8"* ) desc="Windows 8" ;; "win10"* ) desc="Windows 10" ;; @@ -577,7 +577,7 @@ fromFile() { ;; "nano11"* | "nano_11"* ) id="nano11" - ;; + ;; "tiny11core"* | "tiny11_core"* | "tiny_11_core"* ) id="core11" ;; diff --git a/src/mido.sh b/src/mido.sh index a6dada2..5c0b2b5 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -364,6 +364,36 @@ getWindows() { return 0 } +getBuild() { + + local id="$1" + local ret="$2" + local url="" + local name="" + local build="$3" + local edition="" + local file="catalog.xml" + + case "${id,,}" in + "win11${PLATFORM,,}" ) + name="Windows 11 Pro" + url="https://worproject.com/dldserv/esd/getcatalog.php?build=${build}&arch=${PLATFORM^^}&edition=Professional" ;; + "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval") + name="Windows 11 Enterprise" + url="https://worproject.com/dldserv/esd/getcatalog.php?build=${build}&arch=${PLATFORM^^}&edition=Enterprise" ;; + esac + + case "${ret,,}" in + "url" ) echo "$url" ;; + "file" ) echo "$file" ;; + "name" ) echo "$name" ;; + "edition" ) echo "$edition" ;; + *) echo "";; + esac + + return 0 +} + getCatalog() { local id="$1" @@ -371,6 +401,14 @@ getCatalog() { local url="" local name="" local edition="" + local file="catalog.cab" + + if [[ "${id,,}" == "win11"* && "${PLATFORM,,}" != "x64" && "${ARCH,,}" == "arm64" ]]; then + # ARMv8.0 cannot run Windows 11 builds higher than 22631 + if ! grep -qw 'Features.*atomics' /proc/cpuinfo; then + "$(getBuild "$1" "$2" "22631.2861")" && return 0 + fi + fi case "${id,,}" in "win11${PLATFORM,,}" ) @@ -393,8 +431,9 @@ getCatalog() { case "${ret,,}" in "url" ) echo "$url" ;; + "file" ) echo "$file" ;; "name" ) echo "$name" ;; - "edition" ) echo "$edition" ;; + "edition" ) echo '[Edition="'"${edition}"'"]' ;; *) echo "";; esac @@ -407,62 +446,71 @@ getESD() { local version="$2" local lang="$3" local desc="$4" + local file local result local culture local language - local editionName - local winCatalog + local edition + local catalog + file=$(getCatalog "$version" "file") + catalog=$(getCatalog "$version" "url") culture=$(getLanguage "$lang" "culture") - winCatalog=$(getCatalog "$version" "url") - editionName=$(getCatalog "$version" "edition") + edition=$(getCatalog "$version" "edition") - if [ -z "$winCatalog" ] || [ -z "$editionName" ]; then + if [ -z "$file" ] || [ -z "$catalog" ]; then error "Invalid VERSION specified, value \"$version\" is not recognized!" && return 1 fi - local msg="Downloading product information from Microsoft server..." + local msg="Downloading product information..." info "$msg" && html "$msg" rm -rf "$dir" mkdir -p "$dir" - local wFile="catalog.cab" local xFile="products.xml" local eFile="esd_edition.xml" local fFile="products_filter.xml" - { wget "$winCatalog" -O "$dir/$wFile" -q --timeout=30 --no-http-keep-alive; rc=$?; } || : + { wget "$catalog" -O "$dir/$file" -q --timeout=30 --no-http-keep-alive; rc=$?; } || : - msg="Failed to download $winCatalog" + msg="Failed to download $catalog" (( rc == 3 )) && error "$msg , cannot write file (disk full?)" && return 1 (( 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" + if [[ "$file" == *".xml" ]]; then + + mv -f "$dir/$file" "$dir/$xFile" + + else + + cd "$dir" + + if ! cabextract "$file" > /dev/null; then + cd /run + error "Failed to extract $file!" && return 1 + fi - if ! cabextract "$wFile" > /dev/null; then cd /run - error "Failed to extract $wFile!" && return 1 - fi - cd /run + fi if [ ! -s "$dir/$xFile" ]; then - error "Failed to find $xFile in $wFile!" && return 1 + error "Failed to find $xFile in $file!" && return 1 fi - local edQuery='//File[Architecture="'${PLATFORM,,}'"][Edition="'${editionName}'"]' + local edQuery='//File[Architecture="'${PLATFORM,,}'"]'"${edition}"'' result=$(xmllint --nonet --xpath "${edQuery}" "$dir/$xFile" 2>/dev/null) if [ -z "$result" ]; then - edQuery='//File[Architecture="'${PLATFORM^^}'"][Edition="'${editionName}'"]' + edQuery='//File[Architecture="'${PLATFORM^^}'"]'"${edition}"'' + result=$(xmllint --nonet --xpath "${edQuery}" "$dir/$xFile" 2>/dev/null) if [ -z "$result" ]; then - desc=$(printEdition "$version" "$desc") language=$(getLanguage "$lang" "desc") error "No download link available for $desc!" && return 1 @@ -623,25 +671,40 @@ downloadFile() { return 1 } +delay() { + + local i + local delay="$1" + local msg="Will retry in X seconds..." + + info "${msg/X/$delay}" + + for i in $(seq "$delay" -1 1); do + html "${msg/X/$i}" + sleep 1 + done + + return 0 +} + downloadImage() { local iso="$1" local version="$2" local lang="$3" - local delay=5 local tried="n" local success="n" + local seconds="5" local url sum size base desc language - local msg="Will retry after $delay seconds..." if [[ "${version,,}" == "http"* ]]; then base=$(basename "$iso") desc=$(fromFile "$base") - rm -f "$iso" + rm -f "$iso" downloadFile "$iso" "$version" "" "" "" "$desc" && return 0 - info "$msg" && html "$msg" && sleep "$delay" + delay "$seconds" downloadFile "$iso" "$version" "" "" "" "$desc" && return 0 rm -f "$iso" @@ -671,7 +734,7 @@ downloadImage() { if getWindows "$version" "$lang" "$desc"; then success="y" else - info "$msg" && html "$msg" && sleep "$delay" + delay "$seconds" getWindows "$version" "$lang" "$desc" && success="y" fi @@ -679,9 +742,9 @@ downloadImage() { size=$(getMido "$version" "$lang" "size" ) sum=$(getMido "$version" "$lang" "sum") - rm -f "$iso" + rm -f "$iso" downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0 - info "$msg" && html "$msg" && sleep "$delay" + delay "$seconds" downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0 rm -f "$iso" fi @@ -701,7 +764,7 @@ downloadImage() { if getESD "$TMP/esd" "$version" "$lang" "$desc"; then success="y" else - info "$msg" && html "$msg" && sleep "$delay" + delay "$seconds" getESD "$TMP/esd" "$version" "$lang" "$desc" && success="y" fi @@ -710,7 +773,7 @@ downloadImage() { rm -f "$ISO" downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0 - info "$msg" && html "$msg" && sleep "$delay" + delay "$seconds" downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0 rm -f "$ISO" ISO="$iso" @@ -727,14 +790,14 @@ downloadImage() { if [[ "$tried" != "n" ]]; then info "Failed to download $desc, will try another mirror now..." fi - + tried="y" size=$(getSize "$i" "$version" "$lang") sum=$(getHash "$i" "$version" "$lang") - rm -f "$iso" + rm -f "$iso" downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0 - info "$msg" && html "$msg" && sleep "$delay" + delay "$seconds" downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0 rm -f "$iso" fi From e56f059bd2023548214738f8a88a620b70ed141e Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 22 Sep 2025 09:33:42 +0200 Subject: [PATCH 4/6] feat: Implement ARM compatibility check for Windows 11 (#1417) --- src/define.sh | 4 ++++ src/mido.sh | 6 ++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/define.sh b/src/define.sh index 62a6f9e..9da1979 100644 --- a/src/define.sh +++ b/src/define.sh @@ -1885,6 +1885,10 @@ skipVersion() { return 1 } +isCompatible() { + return 0 +} + setMachine() { local id="$1" diff --git a/src/mido.sh b/src/mido.sh index 5c0b2b5..dba6dfb 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -403,11 +403,9 @@ getCatalog() { local edition="" local file="catalog.cab" - if [[ "${id,,}" == "win11"* && "${PLATFORM,,}" != "x64" && "${ARCH,,}" == "arm64" ]]; then + if [[ "${id,,}" == "win11"* ]] && ! isCompatible; then # ARMv8.0 cannot run Windows 11 builds higher than 22631 - if ! grep -qw 'Features.*atomics' /proc/cpuinfo; then - "$(getBuild "$1" "$2" "22631.2861")" && return 0 - fi + getBuild "$1" "$2" "22631.2861" && return 0 fi case "${id,,}" in From f5dc146f0288ae596b2d6ee24f05eb6fa4a99679 Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 22 Sep 2025 11:11:45 +0200 Subject: [PATCH 5/6] docs: Update comment for Windows 11 ARM compatibility --- src/mido.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mido.sh b/src/mido.sh index dba6dfb..234844b 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -404,7 +404,7 @@ getCatalog() { local file="catalog.cab" if [[ "${id,,}" == "win11"* ]] && ! isCompatible; then - # ARMv8.0 cannot run Windows 11 builds higher than 22631 + # ARMv8.0 cannot run Windows 11 24H2 and higher getBuild "$1" "$2" "22631.2861" && return 0 fi From 82499a3181930d44b6c50ce243472467467173e3 Mon Sep 17 00:00:00 2001 From: Kroese Date: Mon, 22 Sep 2025 11:17:08 +0200 Subject: [PATCH 6/6] fix: Make message clearer --- src/mido.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mido.sh b/src/mido.sh index 234844b..2ac83ac 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -404,7 +404,7 @@ getCatalog() { local file="catalog.cab" if [[ "${id,,}" == "win11"* ]] && ! isCompatible; then - # ARMv8.0 cannot run Windows 11 24H2 and higher + # ARMv8.0 cannot run Windows 11 builds 24H2 and up. getBuild "$1" "$2" "22631.2861" && return 0 fi