From d664bd0cf713f47fd80c7fadfbc594d5fdafbfd0 Mon Sep 17 00:00:00 2001 From: Kroese Date: Thu, 16 May 2024 19:48:11 +0200 Subject: [PATCH] feat: Refactor download code --- src/install.sh | 62 -------------------------------------------------- 1 file changed, 62 deletions(-) diff --git a/src/install.sh b/src/install.sh index 223960d..283e36f 100644 --- a/src/install.sh +++ b/src/install.sh @@ -209,68 +209,6 @@ detectCustom() { return 0 } -downloadImage() { - - local iso="$1" - local version="$2" - local tried="n" - local url sum size base desc - - if [[ "${version,,}" == "http"* ]]; then - base=$(basename "$iso") - desc=$(fromFile "$base") - downloadFile "$iso" "$version" "" "" "$desc" && return 0 - return 1 - fi - - if ! validVersion "$version"; then - error "Invalid VERSION specified, value \"$version\" is not recognized!" && return 1 - fi - - desc=$(printVersion "$version" "") - - if isMido "$version"; then - tried="y" - doMido "$iso" "$version" "$desc" && return 0 - fi - - switchEdition "$version" - - if isESD "$version"; then - - if [[ "$tried" != "n" ]]; then - info "Failed to download $desc using Mido, will try a diferent method now..." - fi - - tried="y" - - if getESD "$TMP/esd" "$version"; then - ISO="${ISO%.*}.esd" - downloadFile "$ISO" "$ESD" "$ESD_SUM" "$ESD_SIZE" "$desc" && return 0 - ISO="$iso" - fi - - fi - - for ((i=1;i<=MIRRORS;i++)); do - - url=$(getLink "$i" "$version") - - if [ -n "$url" ]; then - if [[ "$tried" != "n" ]]; then - info "Failed to download $desc, will try another mirror now..." - fi - tried="y" - size=$(getSize "$i" "$version") - sum=$(getHash "$i" "$version") - downloadFile "$iso" "$url" "$sum" "$size" "$desc" && return 0 - fi - - done - - return 1 -} - removeDownload() { local iso="$1"