Update install.sh

This commit is contained in:
Kroese 2024-04-29 03:34:01 +02:00 committed by GitHub
parent 83dc97162d
commit 635c10580b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -315,32 +315,35 @@ downloadImage() {
local iso="$1"
local version="$2"
local url=""
local tried="n"
local rc desc
if [[ "${version,,}" != "http"* ]]; then
desc=$(printVersion "$version" "Windows")
else
if [[ "${version,,}" == "http"* ]]; then
url="$version"
desc=$(getName "$BASE" "$BASE")
fi
else
if [ -z "$url" ]; then
if ! validVersion "$version"; then
error "Invalid VERSION value: $version" && return 1
fi
desc=$(printVersion "$version" "Windows")
if isMido "$version"; then
tried="y"
doMido "$iso" "$version" "$desc" && return 0
fi
if isESD "$version"; then
info "Failed to download $desc using Mido, will try a different method now..."
[[ "$tried" != "n" ]] && info "Failed to download $desc using Mido, will try a different method now..."
ISO="$TMP/$version.esd"
iso="$ISO"
tried="y"
rm -rf "$TMP"
mkdir -p "$TMP"
@ -356,22 +359,40 @@ downloadImage() {
[[ "${version,,}" == "http"* ]] && return 1
url=$(getLink "$version")
if [ -z "$url" ]; then
! isMido "$version" && error "Invalid version specified: $version"
return 1
fi
isMido "$version" && info "Failed to download $desc from Microsoft, will try another mirror now..."
ISO="$TMP/$BASE"
iso="$ISO"
rm -rf "$TMP"
mkdir -p "$TMP"
url=$(getLink "$version")
downloadFile "$iso" "$url" "$desc" && return 0
if [ -n "$url" ]; then
if [[ "$tried" != "n" ]]; then
info "Failed to download $desc from Microsoft, will try another mirror now..."
fi
tried="y"
rm -rf "$TMP"
mkdir -p "$TMP"
downloadFile "$iso" "$url" "$desc" && return 0
fi
url=$(secondLink "$version")
if [ -n "$url" ]; then
if [[ "$tried" != "n" ]]; then
info "Failed to download $desc, will try another mirror now..."
fi
tried="y"
rm -rf "$TMP"
mkdir -p "$TMP"
downloadFile "$iso" "$url" "$desc" && return 0
fi
return 1
}