Compare commits

..

4 commits

Author SHA1 Message Date
Kroese
8471d296ea
fix: Formatting issues 2025-09-21 23:22:12 +02:00
Kroese
6470d19bc7
fix: Formatting issues 2025-09-21 23:15:06 +02:00
Kroese
425a661c93
revert: Simplify conditional checks 2025-09-21 23:11:56 +02:00
Kroese
465d0065b9
feat: Read product catalog from WoR project 2025-09-21 15:25:21 +02:00
2 changed files with 49 additions and 73 deletions

View file

@ -1885,10 +1885,6 @@ skipVersion() {
return 1
}
isCompatible() {
return 0
}
setMachine() {
local id="$1"

View file

@ -364,36 +364,6 @@ 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"
@ -403,11 +373,6 @@ getCatalog() {
local edition=""
local file="catalog.cab"
if [[ "${id,,}" == "win11"* ]] && ! isCompatible; then
# ARMv8.0 cannot run Windows 11 builds 24H2 and up.
getBuild "$1" "$2" "22631.2861" && return 0
fi
case "${id,,}" in
"win11${PLATFORM,,}" )
edition="Professional"
@ -431,7 +396,38 @@ getCatalog() {
"url" ) echo "$url" ;;
"file" ) echo "$file" ;;
"name" ) echo "$name" ;;
"edition" ) echo '[Edition="'"${edition}"'"]' ;;
"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 "";;
esac
@ -448,15 +444,15 @@ getESD() {
local result
local culture
local language
local edition
local catalog
local editionName
local winCatalog
file=$(getCatalog "$version" "file")
catalog=$(getCatalog "$version" "url")
culture=$(getLanguage "$lang" "culture")
edition=$(getCatalog "$version" "edition")
winCatalog=$(getCatalog "$version" "url")
editionName=$(getCatalog "$version" "edition")
if [ -z "$file" ] || [ -z "$catalog" ]; then
if [ -z "$file" ] || [ -z "$winCatalog" ] || [ -z "$editionName" ]; then
error "Invalid VERSION specified, value \"$version\" is not recognized!" && return 1
fi
@ -470,9 +466,9 @@ getESD() {
local eFile="esd_edition.xml"
local fFile="products_filter.xml"
{ wget "$catalog" -O "$dir/$file" -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 $catalog"
msg="Failed to download $winCatalog"
(( 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
@ -499,13 +495,12 @@ getESD() {
error "Failed to find $xFile in $file!" && return 1
fi
local edQuery='//File[Architecture="'${PLATFORM,,}'"]'"${edition}"''
local edQuery='//File[Architecture="'${PLATFORM,,}'"][Edition="'${editionName}'"]'
result=$(xmllint --nonet --xpath "${edQuery}" "$dir/$xFile" 2>/dev/null)
if [ -z "$result" ]; then
edQuery='//File[Architecture="'${PLATFORM^^}'"]'"${edition}"''
edQuery='//File[Architecture="'${PLATFORM^^}'"][Edition="'${editionName}'"]'
result=$(xmllint --nonet --xpath "${edQuery}" "$dir/$xFile" 2>/dev/null)
if [ -z "$result" ]; then
@ -669,31 +664,16 @@ 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
@ -702,7 +682,7 @@ downloadImage() {
rm -f "$iso"
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
delay "$seconds"
info "$msg" && html "$msg" && sleep "$delay"
downloadFile "$iso" "$version" "" "" "" "$desc" && return 0
rm -f "$iso"
@ -732,7 +712,7 @@ downloadImage() {
if getWindows "$version" "$lang" "$desc"; then
success="y"
else
delay "$seconds"
info "$msg" && html "$msg" && sleep "$delay"
getWindows "$version" "$lang" "$desc" && success="y"
fi
@ -742,7 +722,7 @@ downloadImage() {
rm -f "$iso"
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
delay "$seconds"
info "$msg" && html "$msg" && sleep "$delay"
downloadFile "$iso" "$MIDO_URL" "$sum" "$size" "$lang" "$desc" && return 0
rm -f "$iso"
fi
@ -762,7 +742,7 @@ downloadImage() {
if getESD "$TMP/esd" "$version" "$lang" "$desc"; then
success="y"
else
delay "$seconds"
info "$msg" && html "$msg" && sleep "$delay"
getESD "$TMP/esd" "$version" "$lang" "$desc" && success="y"
fi
@ -771,7 +751,7 @@ downloadImage() {
rm -f "$ISO"
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
delay "$seconds"
info "$msg" && html "$msg" && sleep "$delay"
downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$lang" "$desc" && return 0
rm -f "$ISO"
ISO="$iso"
@ -795,7 +775,7 @@ downloadImage() {
rm -f "$iso"
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
delay "$seconds"
info "$msg" && html "$msg" && sleep "$delay"
downloadFile "$iso" "$url" "$sum" "$size" "$lang" "$desc" && return 0
rm -f "$iso"
fi