Update install.sh

This commit is contained in:
Kroese 2024-05-02 23:58:44 +02:00 committed by GitHub
parent 92019dc1ba
commit 526e14c448
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -290,15 +290,13 @@ doMido() {
verifyFile() { verifyFile() {
local iso="$1" local iso="$1"
local version="$2" local check="$2"
local hash="" local hash=""
local check=""
html "Verifying downloaded ISO..." html "Verifying downloaded ISO..."
info "Calculating SHA256 checksum of the ISO file..." info "Calculating SHA256 checksum of the ISO file..."
hash=$(sha256sum "$iso" | cut -f1 -d' ') hash=$(sha256sum "$iso" | cut -f1 -d' ')
[ -n "$version" ] && check=$(getHash "$version")
if [ -z "$check" ]; then if [ -z "$check" ]; then
info "The sha256 checksum is: $hash , but have no value available for comparison." && return 0 info "The sha256 checksum is: $hash , but have no value available for comparison." && return 0
@ -318,8 +316,8 @@ downloadFile() {
local iso="$1" local iso="$1"
local url="$2" local url="$2"
local desc="$3" local sum="$3"
local version="$4" local desc="$4"
local rc progress domain dots local rc progress domain dots
rm -f "$iso" rm -f "$iso"
@ -351,7 +349,7 @@ downloadFile() {
if (( rc == 0 )) && [ -f "$iso" ]; then if (( rc == 0 )) && [ -f "$iso" ]; then
if [ "$(stat -c%s "$iso")" -gt 100000000 ]; then if [ "$(stat -c%s "$iso")" -gt 100000000 ]; then
if [[ "$VERIFY" == [Yy1]* ]]; then if [[ "$VERIFY" == [Yy1]* ]]; then
! verifyFile "$iso" "$version" && return 1 ! verifyFile "$iso" "$sum" && return 1
fi fi
html "Download finished successfully..." && return 0 html "Download finished successfully..." && return 0
fi fi
@ -368,11 +366,11 @@ downloadImage() {
local iso="$1" local iso="$1"
local version="$2" local version="$2"
local tried="n" local tried="n"
local url desc local url sum desc
if [[ "${version,,}" == "http"* ]]; then if [[ "${version,,}" == "http"* ]]; then
desc=$(getName "$BASE") desc=$(getName "$BASE")
downloadFile "$iso" "$version" "$desc" "" && return 0 downloadFile "$iso" "$version" "" "$desc" && return 0
return 1 return 1
fi fi
@ -400,7 +398,7 @@ downloadImage() {
if getESD "$TMP/esd" "$version"; then if getESD "$TMP/esd" "$version"; then
ISO="$TMP/$version.esd" ISO="$TMP/$version.esd"
downloadFile "$ISO" "$ESD_URL" "$desc" "" && return 0 downloadFile "$ISO" "$ESD_URL" "" "$desc" && return 0
ISO="$TMP/$BASE" ISO="$TMP/$BASE"
fi fi
@ -415,7 +413,8 @@ downloadImage() {
info "Failed to download $desc, will try another mirror now..." info "Failed to download $desc, will try another mirror now..."
fi fi
tried="y" tried="y"
downloadFile "$iso" "$url" "$desc" "$version" && return 0 sum=$(getHash "$i" "$version")
downloadFile "$iso" "$url" "$sum" "$desc" && return 0
fi fi
done done