From dfd4175a90a7c0fbd67799b9e3ad93611027c904 Mon Sep 17 00:00:00 2001
From: Jan Buethe <jbuethe@amazon.de>
Date: Sun, 21 Apr 2024 16:45:48 +0200
Subject: [PATCH] updates in download_model.sh (more verbose now)

---
 dnn/download_model.sh | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/dnn/download_model.sh b/dnn/download_model.sh
index 083cf7536..75108e33f 100755
--- a/dnn/download_model.sh
+++ b/dnn/download_model.sh
@@ -8,22 +8,21 @@ if [ ! -f $model ]; then
         wget https://media.xiph.org/opus/models/$model
 fi
 
-SHA256=$(command -v sha256sum)
-if [ "$?" != "0" ]
+if command -v sha256sum
 then
-   echo "Could not find sha256 sum. Skipping verification. Please verify manually that sha256 hash of ${model} matches ${1}."
-else
    echo "Validating checksum"
-   checksum=$1
+   checksum="$1"
    checksum2=$(sha256sum $model | awk '{print $1}')
    if [ "$checksum" != "$checksum2" ]
    then
-      echo "checksums don't match, aborting"
+      echo "Aborting due to mismatching checksums. This could be caused by a corrupted download of $model."
+      echo "Consider deleting local copy of $model and running this script again."
       exit 1
    else
       echo "checksums match"
    fi
-
+else
+   echo "Could not find sha256 sum; skipping verification. Please verify manually that sha256 hash of ${model} matches ${1}."
 fi
 
 
-- 
GitLab