From 465d0065b9a827f3b59b6e370413569edf02ff71 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 21 Sep 2025 15:25:21 +0200 Subject: [PATCH 1/4] feat: Read product catalog from WoR project --- src/mido.sh | 63 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/src/mido.sh b/src/mido.sh index a6dada2..49bc732 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -371,7 +371,8 @@ getCatalog() { local url="" local name="" local edition="" - + local file="catalog.cab" + case "${id,,}" in "win11${PLATFORM,,}" ) edition="Professional" @@ -393,6 +394,38 @@ getCatalog() { case "${ret,,}" in "url" ) echo "$url" ;; + "file" ) echo "$file" ;; + "name" ) echo "$name" ;; + "edition" ) echo "$edition" ;; + *) echo "";; + esac + + return 0 +} + +getOldCatalog() { + + local id="$1" + local ret="$2" + local url="" + local name="" + local edition="" + local file="catalog.xml" + + case "${id,,}" in + "win11${PLATFORM,,}" ) + edition="Professional" + name="Windows 11 Pro" + url="https://worproject.com/dldserv/esd/getcatalog.php?build=22631.2861&arch=ARM64&edition=Professional" ;; + "win11${PLATFORM,,}-enterprise" | "win11${PLATFORM,,}-enterprise-eval") + edition="Enterprise" + name="Windows 11 Enterprise" + url="https://worproject.com/dldserv/esd/getcatalog.php?build=22631.2861&arch=ARM64&edition=Enterprise" ;; + esac + + case "${ret,,}" in + "url" ) echo "$url" ;; + "file" ) echo "$file" ;; "name" ) echo "$name" ;; "edition" ) echo "$edition" ;; *) echo "";; @@ -407,17 +440,19 @@ getESD() { local version="$2" local lang="$3" local desc="$4" + local file local result local culture local language local editionName local winCatalog + file=$(getCatalog "$version" "file") culture=$(getLanguage "$lang" "culture") winCatalog=$(getCatalog "$version" "url") editionName=$(getCatalog "$version" "edition") - if [ -z "$winCatalog" ] || [ -z "$editionName" ]; then + if [ -z "$file" || -z "$winCatalog" || -z "$editionName" ]; then error "Invalid VERSION specified, value \"$version\" is not recognized!" && return 1 fi @@ -427,12 +462,11 @@ getESD() { 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 "$winCatalog" -O "$dir/$file" -q --timeout=30 --no-http-keep-alive; rc=$?; } || : msg="Failed to download $winCatalog" (( rc == 3 )) && error "$msg , cannot write file (disk full?)" && return 1 @@ -440,17 +474,25 @@ getESD() { (( 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 - 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}'"]' @@ -462,7 +504,6 @@ getESD() { 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 From 425a661c93fa34218d90a5012c628f4c46e688dd Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 21 Sep 2025 23:11:56 +0200 Subject: [PATCH 2/4] revert: Simplify conditional checks --- src/mido.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mido.sh b/src/mido.sh index 49bc732..4c01efc 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -452,7 +452,7 @@ getESD() { winCatalog=$(getCatalog "$version" "url") editionName=$(getCatalog "$version" "edition") - if [ -z "$file" || -z "$winCatalog" || -z "$editionName" ]; then + if [ -z "$file" ] || [ -z "$winCatalog" ] || [ -z "$editionName" ]; then error "Invalid VERSION specified, value \"$version\" is not recognized!" && return 1 fi From 6470d19bc7c2fabf3c9bfb9f40be77b50b4d9107 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 21 Sep 2025 23:15:06 +0200 Subject: [PATCH 3/4] fix: Formatting issues --- src/define.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 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" ;; From 8471d296eab133a4ead3c881ec1ca747e94e1d14 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sun, 21 Sep 2025 23:22:12 +0200 Subject: [PATCH 4/4] fix: Formatting issues --- src/mido.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/mido.sh b/src/mido.sh index 4c01efc..c84b28b 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -372,7 +372,7 @@ getCatalog() { local name="" local edition="" local file="catalog.cab" - + case "${id,,}" in "win11${PLATFORM,,}" ) edition="Professional" @@ -411,7 +411,7 @@ getOldCatalog() { local name="" local edition="" local file="catalog.xml" - + case "${id,,}" in "win11${PLATFORM,,}" ) edition="Professional" @@ -456,7 +456,7 @@ getESD() { 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" @@ -680,7 +680,7 @@ downloadImage() { base=$(basename "$iso") desc=$(fromFile "$base") - rm -f "$iso" + rm -f "$iso" downloadFile "$iso" "$version" "" "" "" "$desc" && return 0 info "$msg" && html "$msg" && sleep "$delay" downloadFile "$iso" "$version" "" "" "" "$desc" && return 0 @@ -720,7 +720,7 @@ 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" downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0 @@ -768,12 +768,12 @@ 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" downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0