From 471d77ee470af933e65cf373cfaac07eb6cbb329 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sat, 4 May 2019 01:17:39 +0200 Subject: [PATCH] Fix download-nasnet.sh script --- scripts/download-nasnet.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/download-nasnet.sh b/scripts/download-nasnet.sh index f25e2a394..36a7804cf 100755 --- a/scripts/download-nasnet.sh +++ b/scripts/download-nasnet.sh @@ -12,24 +12,26 @@ MODEL_BACKUP="assets/backups/nasnet-$TODAY" echo "Installing $MODEL_NAME for TensorFlow..." -# Check for update -if [[ -f ${MODEL_ZIP} ]] && [[ `sha1sum ${MODEL_ZIP}` == ${MODEL_HASH} ]]; then - echo "Already up to date." - exit -fi - # Create directories mkdir -p /tmp/photoprism mkdir -p assets/tensorflow mkdir -p assets/backups -# Download model -echo "Downloading latest model from $MODEL_URL..." -wget ${MODEL_URL} -O ${MODEL_ZIP} +# Check for update +if [[ -f ${MODEL_ZIP} ]] && [[ `sha1sum ${MODEL_ZIP}` == ${MODEL_HASH} ]]; then + if [[ -f ${MODEL_VERSION} ]]; then + echo "Already up to date." + exit + fi +else + # Download model + echo "Downloading latest model from $MODEL_URL..." + wget ${MODEL_URL} -O ${MODEL_ZIP} -TMP_HASH=`sha1sum ${MODEL_ZIP}` + TMP_HASH=`sha1sum ${MODEL_ZIP}` -echo ${TMP_HASH} + echo ${TMP_HASH} +fi # Create backup if [[ -e ${MODEL_PATH} ]]; then