From 8f84b56512817323870c512b34a4f2e607e64834 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 24 Apr 2024 16:00:51 +0200 Subject: [PATCH] feat: Add additional download mirrors --- src/install.sh | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/src/install.sh b/src/install.sh index 9053ae7..a90872d 100644 --- a/src/install.sh +++ b/src/install.sh @@ -483,18 +483,18 @@ downloadImage() { fi fi - if [[ "$VERSION" != "win10x64"* ]] && [[ "$VERSION" != "win11x64" ]]; then + if [[ "$VERSION" != "win10x64" ]] && [[ "$VERSION" != "win11x64" ]]; then error "Failed to download $desc" && return 1 fi info "Failed to download $desc using Mido, will try a different method now..." + rm -f "$iso" rm -rf "$TMP" mkdir -p "$TMP" ISO="$TMP/$VERSION.esd" iso="$ISO" - file="$ISO" rm -f "$iso" if ! getESD "$TMP/esd" "$iso"; then @@ -526,6 +526,46 @@ downloadImage() { fi fi + if [[ "$EXTERNAL" != [Yy1]* ]]; then + + case "${VERSION,,}" in + "win11${ARCH,,}") + url="https://dl.bobpony.com/windows/11/en-us_windows_11_23h2_x64.iso" + ;; + "win10${ARCH,,}") + url="https://dl.bobpony.com/windows/10/en-us_windows_10_22h2_x64.iso" + ;; + *) + error "Failed to download $url" && return 1 + ;; + esac + + info "Failed to download $desc from Microsoft, will try a different method now..." + + rm -f "$iso" + rm -rf "$TMP" + mkdir -p "$TMP" + + ISO="$TMP/$BASE" + iso="$ISO" + rm -f "$iso" + + msg="Downloading $desc..." + info "$msg" && html "$msg" + /run/progress.sh "$iso" "Downloading $desc ([P])..." & + + { wget "$url" -O "$iso" -q --no-check-certificate --show-progress "$progress"; rc=$?; } || : + + fKill "progress.sh" + (( rc != 0 )) && error "Failed to download $url , reason: $rc" && return 1 + + if [ -f "$iso" ]; then + if [ $(stat -c%s "$iso") -gt 100000000 ]; then + html "Download finished successfully..." && return 0 + fi + fi + fi + error "Failed to download $url" && return 1 }