From fb989990267387cd25c3f82946ad740df8514c1e Mon Sep 17 00:00:00 2001 From: Kroese Date: Tue, 30 Apr 2024 23:20:15 +0200 Subject: [PATCH] Update define.sh --- src/define.sh | 98 +++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 54 deletions(-) diff --git a/src/define.sh b/src/define.sh index 423ee5b..2175587 100644 --- a/src/define.sh +++ b/src/define.sh @@ -26,38 +26,6 @@ parseVersion() { return 0 } -validVersion() { - - local id="$1" - - case "${id,,}" in - "win11${PLATFORM,,}") - return 0 - ;; - "win10${PLATFORM,,}") - return 0 - ;; - esac - - return 1 -} - -isESD() { - - local id="$1" - - case "${id,,}" in - "win11${PLATFORM,,}") - return 0 - ;; - "win10${PLATFORM,,}") - return 0 - ;; - esac - - return 1 -} - printVersion() { local id="$1" @@ -83,18 +51,10 @@ getName() { [[ "${file,,}" == *"windows10"* ]] && desc="Windows 10" [[ "${file,,}" == *"windows_11"* ]] && desc="Windows 11" [[ "${file,,}" == *"windows_10"* ]] && desc="Windows 10" + [[ "${file,,}" == *"windows 11"* ]] && desc="Windows 11" + [[ "${file,,}" == *"windows 10"* ]] && desc="Windows 10" - if [ -z "$desc" ]; then - desc="Windows" - else - if [[ "$desc" == "Windows 1"* ]] && [[ "${file,,}" == *"_iot_"* ]]; then - desc="$desc IoT" - else - if [[ "$desc" == "Windows 1"* ]] && [[ "${file,,}" == *"_ltsc_"* ]]; then - desc="$desc LTSC" - fi - fi - fi + [ -z "$desc" ] && desc="Windows" echo "$desc for ${PLATFORM}" return 0 @@ -112,28 +72,23 @@ getVersion() { return 0 } -getLink() { - - # Fallbacks for users who cannot connect to the Microsoft servers +isESD() { local id="$1" - local url="" - local host="https://drive.massgrave.dev" case "${id,,}" in "win11${PLATFORM,,}") - url="$host/SW_DVD9_Win_Pro_11_23H2.2_Arm64_English_Pro_Ent_EDU_N_MLF_X23-68023.ISO" + return 0 ;; "win10${PLATFORM,,}") - url="$host/SW_DVD9_Win_Pro_10_22H2.15_Arm64_English_Pro_Ent_EDU_N_MLF_X23-67223.ISO" + return 0 ;; esac - echo "$url" - return 0 + return 1 } -secondLink() { +getLink() { # Fallbacks for users who cannot connect to the Microsoft servers @@ -154,4 +109,39 @@ secondLink() { return 0 } -return 0 +secondLink() { + + # Fallbacks for users who cannot connect to the Microsoft servers + + local id="$1" + local url="" + local host="https://drive.massgrave.dev" + + case "${id,,}" in + "win11${PLATFORM,,}") + url="$host/SW_DVD9_Win_Pro_11_23H2.2_Arm64_English_Pro_Ent_EDU_N_MLF_X23-68023.ISO" + ;; + "win10${PLATFORM,,}") + url="$host/SW_DVD9_Win_Pro_10_22H2.15_Arm64_English_Pro_Ent_EDU_N_MLF_X23-67223.ISO" + ;; + esac + + echo "$url" + return 0 +} + +validVersion() { + + local id="$1" + local url + + isESD "$id" && return 0 + + url=$(getLink "$id") + [ -n "$url" ] && return 0 + + url=$(secondLink "$id") + [ -n "$url" ] && return 0 + + return 1 +}