From b1ca283ba8c464c60f941fa8b5b954e5525edeba Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 13 Nov 2024 13:07:17 +0100 Subject: [PATCH 01/14] build: Use latest ARM image --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f7252ce69..98089ef30 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -ARG VERSION_ARG="4.00" - +ARG VERSION_ARG="latest" FROM scratch AS build-amd64 + COPY --from=qemux/qemu-docker:6.07 / / ARG DEBCONF_NOWARNINGS="yes" @@ -34,7 +34,7 @@ ADD --chmod=664 https://github.com/qemus/virtiso-whql/releases/download/v1.9.43- FROM dockurr/windows-arm:${VERSION_ARG} AS build-arm64 FROM build-${TARGETARCH} -ARG VERSION_ARG="4.00" +ARG VERSION_ARG="0.00" RUN echo "$VERSION_ARG" > /run/version VOLUME /storage From 2ace98f46d494c3e8a086965f510be48ebea7823 Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 15 Nov 2024 00:17:14 +0100 Subject: [PATCH 02/14] fix: Remove Windows 8.1 Pro --- src/define.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/define.sh b/src/define.sh index a2706e3e0..3be4e4285 100644 --- a/src/define.sh +++ b/src/define.sh @@ -671,10 +671,6 @@ getMido() { size=4898582528 sum="e4ab2e3535be5748252a8d5d57539a6e59be8d6726345ee10e7afd2cb89fefb5" ;; - "win81x64" ) - size=4320526336 - sum="d8333cf427eb3318ff6ab755eb1dd9d433f0e2ae43745312c1cd23e83ca1ce51" - ;; "win81x64-enterprise-eval" ) size=3961473024 sum="2dedd44c45646c74efc5a028f65336027e14a56f76686a4631cf94ffe37c72f2" From c2012a9e329927de74f96a23c55d313371a8d9bb Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 15 Nov 2024 00:41:30 +0100 Subject: [PATCH 03/14] feat: Rework download code --- src/mido.sh | 119 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 42 deletions(-) diff --git a/src/mido.sh b/src/mido.sh index d739553a7..a6a444bd6 100644 --- a/src/mido.sh +++ b/src/mido.sh @@ -57,36 +57,71 @@ get_agent() { return 0 } +convert_language() { + + local lang="" + + case "${1,,}" in + "gb" | "en-gb" ) + lang="English International" ;; + "en" | "en-"* ) + lang="English" ;; + "mx" | "es-mx" ) + lang="Spanish (Mexico)" ;; + "ca" | "fr-ca" ) + lang="French Canadian" ;; + "br" | "pt-br" ) + lang="Brazilian Portuguese" ;; + "sr" | "sr-"* ) + lang="Serbian Latin" ;; + "hk" | "zh-hk" | "cn-hk" ) + lang="Chinese (Traditional)" ;; + "tw" | "zh-tw" | "cn-tw" ) + lang="Chinese (Traditional)" ;; + "zh" | "zh-"* | "cn" | "cn-"* ) + lang="Chinese (Simplified)" ;; + * ) + lang=$(getLanguage "$1" "name") ;; + esac + + + echo "$lang" + return 0 +} + download_windows() { local id="$1" local lang="$2" local desc="$3" local sku_id="" + local sku_url="" + local iso_url="" + local iso_json="" local language="" local session_id="" local user_agent="" + local download_type="" local windows_version="" local iso_download_link="" + local download_page_html="" local product_edition_id="" - local iso_download_link_html="" - local iso_download_page_html="" - local language_skuid_table_html="" + local language_skuid_json="" + local profile="606624d44113" + + user_agent=$(get_agent) + language=$(convert_language "$lang") + [ -z "$language" ] && error "Invalid language: $lang" && return 1 case "${id,,}" in - "win11x64" ) windows_version="11" ;; - "win10x64" ) windows_version="10" ;; - "win81x64" ) windows_version="8" ;; + "win11x64" ) windows_version="11" && download_type="1" ;; + "win10x64" ) windows_version="10" && download_type="1" ;; + "win11arm64" ) windows_version="11arm64" && download_type="2" ;; * ) error "Invalid VERSION specified, value \"$id\" is not recognized!" && return 1 ;; esac - user_agent=$(get_agent) - language=$(getLanguage "$lang" "name") - local url="https://www.microsoft.com/en-us/software-download/windows$windows_version" - case "$windows_version" in - 8 | 10) url+="ISO";; - esac + [[ "${id,,}" == "win10"* ]] && url+="ISO" # 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 session_id=$(cat /proc/sys/kernel/random/uuid 2> /dev/null || uuidgen --random) @@ -96,44 +131,40 @@ download_windows() { # This is the *only* request we make that Fido doesn't. Fido manually maintains a list of all the Windows release/edition product edition IDs in its script (see: $WindowsVersions array). This is helpful for downloading older releases (e.g. Windows 10 1909, 21H1, etc.) but we always want to get the newest release which is why we get this value dynamically # Also, keeping a "$WindowsVersions" array like Fido does would be way too much of a maintenance burden # Remove "Accept" header that curl sends by default - [[ "$DEBUG" == [Yy1]* ]] && echo " - Parsing download page: ${url}" - iso_download_page_html=$(curl --silent --max-time 30 --user-agent "$user_agent" --header "Accept:" --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || { + [[ "$DEBUG" == [Yy1]* ]] && echo "Parsing download page: ${url}" + download_page_html=$(curl --silent --max-time 30 --user-agent "$user_agent" --header "Accept:" --max-filesize 1M --fail --proto =https --tlsv1.2 --http1.1 -- "$url") || { handle_curl_error $? return $? } [[ "$DEBUG" == [Yy1]* ]] && echo -n "Getting Product edition ID: " - # tr: Filter for only numerics to prevent HTTP parameter injection - # head -c was recently added to POSIX: https://austingroupbugs.net/view.php?id=407 - product_edition_id=$(echo "$iso_download_page_html" | grep -Eo '