From 908d32db45fe9fe2baa786dd8adb1716de37fd90 Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 4 May 2024 16:28:48 +0200 Subject: [PATCH] Update install.sh --- src/install.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/install.sh b/src/install.sh index dcb3dfd..635abf8 100644 --- a/src/install.sh +++ b/src/install.sh @@ -293,14 +293,16 @@ verifyFile() { local iso="$1" local check="$2" local hash="" + local algo="SHA256" [ -z "$check" ] && return 0 + [[ "${#check}" == "40" ]] && algo="SHA1" html "Verifying downloaded ISO..." - info "Calculating SHA256 checksum of the ISO file..." + info "Calculating $algo checksum of the ISO file..." - if [[ "${#check}" == "40" ]]; then - hash=$(shasum "$iso" | cut -f1 -d' ') + if [[ "${algo,,}" != "sha256" ]]; then + hash=$(sha1sum "$iso" | cut -f1 -d' ') else hash=$(sha256sum "$iso" | cut -f1 -d' ') fi @@ -309,7 +311,7 @@ verifyFile() { info "Succesfully verified that the checksum was correct!" && return 0 fi - error "Invalid sha256 checksum: $hash , but expected value is: $check ! Please report this at $SUPPORT/issues" + error "Invalid $algo checksum: $hash , but expected value is: $check ! Please report this at $SUPPORT/issues" rm -f "$iso" return 1