Update install.sh

This commit is contained in:
Kroese 2024-05-04 18:18:00 +02:00 committed by GitHub
parent 76765ba766
commit d2d5e9fae2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -291,7 +291,16 @@ doMido() {
verifyFile() { verifyFile() {
local iso="$1" local iso="$1"
local check="$2" local size="$2"
local total="$3"
local check="$4"
if [[ "$total" != "$size" ]]; then
if [ -n "$size" ] && [[ "$size" != "0" ]]; then
warn "The download file has an unexpected size: $total"
fi
fi
local hash="" local hash=""
local algo="SHA256" local algo="SHA256"
@ -324,7 +333,7 @@ downloadFile() {
local sum="$3" local sum="$3"
local size="$4" local size="$4"
local desc="$5" local desc="$5"
local rc progress domain dots local rc total progress domain dots
rm -f "$iso" rm -f "$iso"
@ -353,9 +362,10 @@ downloadFile() {
fKill "progress.sh" fKill "progress.sh"
if (( rc == 0 )) && [ -f "$iso" ]; then if (( rc == 0 )) && [ -f "$iso" ]; then
if [ "$(stat -c%s "$iso")" -gt 100000000 ]; then total=$(stat -c%s "$iso")
if [ "$total" -gt 100000000 ]; then
if [[ "$VERIFY" == [Yy1]* ]] && [ -n "$sum" ]; then if [[ "$VERIFY" == [Yy1]* ]] && [ -n "$sum" ]; then
! verifyFile "$iso" "$sum" && return 1 ! verifyFile "$iso" "$size" "$total" "$sum" && return 1
fi fi
html "Download finished successfully..." && return 0 html "Download finished successfully..." && return 0
fi fi
@ -372,7 +382,7 @@ downloadImage() {
local iso="$1" local iso="$1"
local version="$2" local version="$2"
local tried="n" local tried="n"
local url sum desc local url sum size desc
if [[ "${version,,}" == "http"* ]]; then if [[ "${version,,}" == "http"* ]]; then
desc=$(fromFile "$BASE") desc=$(fromFile "$BASE")
@ -418,8 +428,9 @@ 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"
size=$(getSize "$i" "$version")
sum=$(getHash "$i" "$version") sum=$(getHash "$i" "$version")
downloadFile "$iso" "$url" "$sum" "" "$desc" && return 0 downloadFile "$iso" "$url" "$sum" "$size" "$desc" && return 0
fi fi
done done