CI: Improve compatibility of download scripts
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
f73d21171a
commit
027800fba5
4 changed files with 28 additions and 28 deletions
2
scripts/dist/install-tensorflow.sh
vendored
2
scripts/dist/install-tensorflow.sh
vendored
|
@ -24,7 +24,7 @@ if [[ $(id -u) != "0" ]] && [[ $DESTDIR == "/usr" || $DESTDIR == "/usr/local" ]]
|
|||
exit 1
|
||||
fi
|
||||
|
||||
/bin/mkdir -p "$DESTDIR"
|
||||
mkdir -p "$DESTDIR"
|
||||
|
||||
if [[ $TF_DRIVER == "auto" ]]; then
|
||||
echo "Detecting driver..."
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
TODAY=$(/bin/date -u +%Y%m%d)
|
||||
TODAY=$(date -u +%Y%m%d)
|
||||
|
||||
MODEL_NAME="Facenet"
|
||||
MODEL_URL="https://dl.photoprism.app/tensorflow/facenet.zip?$TODAY"
|
||||
|
@ -13,11 +13,11 @@ MODEL_BACKUP="storage/backup/facenet-$TODAY"
|
|||
echo "Installing $MODEL_NAME model for TensorFlow..."
|
||||
|
||||
# Create directories
|
||||
/bin/mkdir -p /tmp/photoprism
|
||||
/bin/mkdir -p storage/backup
|
||||
mkdir -p /tmp/photoprism
|
||||
mkdir -p storage/backup
|
||||
|
||||
# Check for update
|
||||
if [[ -f ${MODEL_ZIP} ]] && [[ $(/usr/bin/sha1sum ${MODEL_ZIP}) == ${MODEL_HASH} ]]; then
|
||||
if [[ -f ${MODEL_ZIP} ]] && [[ $(sha1sum ${MODEL_ZIP}) == ${MODEL_HASH} ]]; then
|
||||
if [[ -f ${MODEL_VERSION} ]]; then
|
||||
echo "Already up to date."
|
||||
exit
|
||||
|
@ -25,9 +25,9 @@ if [[ -f ${MODEL_ZIP} ]] && [[ $(/usr/bin/sha1sum ${MODEL_ZIP}) == ${MODEL_HASH}
|
|||
else
|
||||
# Download model
|
||||
echo "Downloading latest model from $MODEL_URL..."
|
||||
/usr/bin/wget ${MODEL_URL} -O ${MODEL_ZIP}
|
||||
wget ${MODEL_URL} -O ${MODEL_ZIP}
|
||||
|
||||
TMP_HASH=$(/usr/bin/sha1sum ${MODEL_ZIP})
|
||||
TMP_HASH=$(sha1sum ${MODEL_ZIP})
|
||||
|
||||
echo "${TMP_HASH}"
|
||||
fi
|
||||
|
@ -35,12 +35,12 @@ fi
|
|||
# Create backup
|
||||
if [[ -e ${MODEL_PATH} ]]; then
|
||||
echo "Creating backup of existing directory: $MODEL_BACKUP"
|
||||
/bin/rm -rf "${MODEL_BACKUP}"
|
||||
/bin/mv ${MODEL_PATH} "${MODEL_BACKUP}"
|
||||
rm -rf "${MODEL_BACKUP}"
|
||||
mv ${MODEL_PATH} "${MODEL_BACKUP}"
|
||||
fi
|
||||
|
||||
# Unzip model
|
||||
/usr/bin/unzip ${MODEL_ZIP} -d assets
|
||||
unzip ${MODEL_ZIP} -d assets
|
||||
echo "$MODEL_NAME $TODAY $MODEL_HASH" > ${MODEL_VERSION}
|
||||
|
||||
echo "Latest $MODEL_NAME installed."
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
TODAY=$(/bin/date -u +%Y%m%d)
|
||||
TODAY=$(date -u +%Y%m%d)
|
||||
|
||||
MODEL_NAME="NASNet Mobile"
|
||||
MODEL_URL="https://dl.photoprism.app/tensorflow/nasnet.zip?$TODAY"
|
||||
|
@ -13,11 +13,11 @@ MODEL_BACKUP="storage/backup/nasnet-$TODAY"
|
|||
echo "Installing $MODEL_NAME model for TensorFlow..."
|
||||
|
||||
# Create directories
|
||||
/bin/mkdir -p /tmp/photoprism
|
||||
/bin/mkdir -p storage/backup
|
||||
mkdir -p /tmp/photoprism
|
||||
mkdir -p storage/backup
|
||||
|
||||
# Check for update
|
||||
if [[ -f ${MODEL_ZIP} ]] && [[ $(/usr/bin/sha1sum ${MODEL_ZIP}) == "${MODEL_HASH}" ]]; then
|
||||
if [[ -f ${MODEL_ZIP} ]] && [[ $(sha1sum ${MODEL_ZIP}) == "${MODEL_HASH}" ]]; then
|
||||
if [[ -f ${MODEL_VERSION} ]]; then
|
||||
echo "Already up to date."
|
||||
exit
|
||||
|
@ -25,9 +25,9 @@ if [[ -f ${MODEL_ZIP} ]] && [[ $(/usr/bin/sha1sum ${MODEL_ZIP}) == "${MODEL_HASH
|
|||
else
|
||||
# Download model
|
||||
echo "Downloading latest model from $MODEL_URL..."
|
||||
/usr/bin/wget "${MODEL_URL}" -O ${MODEL_ZIP}
|
||||
wget "${MODEL_URL}" -O ${MODEL_ZIP}
|
||||
|
||||
TMP_HASH=$(/usr/bin/sha1sum ${MODEL_ZIP})
|
||||
TMP_HASH=$(sha1sum ${MODEL_ZIP})
|
||||
|
||||
echo "${TMP_HASH}"
|
||||
fi
|
||||
|
@ -35,12 +35,12 @@ fi
|
|||
# Create backup
|
||||
if [[ -e ${MODEL_PATH} ]]; then
|
||||
echo "Creating backup of existing directory: $MODEL_BACKUP"
|
||||
/bin/rm -rf "${MODEL_BACKUP}"
|
||||
/bin/mv ${MODEL_PATH} "${MODEL_BACKUP}"
|
||||
rm -rf "${MODEL_BACKUP}"
|
||||
mv ${MODEL_PATH} "${MODEL_BACKUP}"
|
||||
fi
|
||||
|
||||
# Unzip model
|
||||
/usr/bin/unzip ${MODEL_ZIP} -d assets
|
||||
unzip ${MODEL_ZIP} -d assets
|
||||
echo "$MODEL_NAME $TODAY $MODEL_HASH" > ${MODEL_VERSION}
|
||||
|
||||
echo "Latest $MODEL_NAME installed."
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
TODAY=$(/bin/date -u +%Y%m%d)
|
||||
TODAY=$(date -u +%Y%m%d)
|
||||
|
||||
MODEL_NAME="NSFW"
|
||||
MODEL_URL="https://dl.photoprism.app/tensorflow/nsfw.zip?$TODAY"
|
||||
|
@ -13,11 +13,11 @@ MODEL_BACKUP="storage/backup/nsfw-$TODAY"
|
|||
echo "Installing $MODEL_NAME model for TensorFlow..."
|
||||
|
||||
# Create directories
|
||||
/bin/mkdir -p /tmp/photoprism
|
||||
/bin/mkdir -p storage/backup
|
||||
mkdir -p /tmp/photoprism
|
||||
mkdir -p storage/backup
|
||||
|
||||
# Check for update
|
||||
if [[ -f ${MODEL_ZIP} ]] && [[ $(/usr/bin/sha1sum ${MODEL_ZIP}) == "${MODEL_HASH}" ]]; then
|
||||
if [[ -f ${MODEL_ZIP} ]] && [[ $(sha1sum ${MODEL_ZIP}) == "${MODEL_HASH}" ]]; then
|
||||
if [[ -f ${MODEL_VERSION} ]]; then
|
||||
echo "Already up to date."
|
||||
exit
|
||||
|
@ -25,9 +25,9 @@ if [[ -f ${MODEL_ZIP} ]] && [[ $(/usr/bin/sha1sum ${MODEL_ZIP}) == "${MODEL_HASH
|
|||
else
|
||||
# Download model
|
||||
echo "Downloading latest model from $MODEL_URL..."
|
||||
/usr/bin/wget "${MODEL_URL}" -O ${MODEL_ZIP}
|
||||
wget "${MODEL_URL}" -O ${MODEL_ZIP}
|
||||
|
||||
TMP_HASH=$(/usr/bin/sha1sum ${MODEL_ZIP})
|
||||
TMP_HASH=$(sha1sum ${MODEL_ZIP})
|
||||
|
||||
echo ${TMP_HASH}
|
||||
fi
|
||||
|
@ -35,12 +35,12 @@ fi
|
|||
# Create backup
|
||||
if [[ -e ${MODEL_PATH} ]]; then
|
||||
echo "Creating backup of existing directory: $MODEL_BACKUP"
|
||||
/bin/rm -rf "${MODEL_BACKUP}"
|
||||
/bin/mv ${MODEL_PATH} "${MODEL_BACKUP}"
|
||||
rm -rf "${MODEL_BACKUP}"
|
||||
mv ${MODEL_PATH} "${MODEL_BACKUP}"
|
||||
fi
|
||||
|
||||
# Unzip model
|
||||
/usr/bin/unzip ${MODEL_ZIP} -d assets
|
||||
unzip ${MODEL_ZIP} -d assets
|
||||
echo "$MODEL_NAME $TODAY $MODEL_HASH" > ${MODEL_VERSION}
|
||||
|
||||
echo "Latest $MODEL_NAME installed."
|
||||
|
|
Loading…
Reference in a new issue