1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-13 12:55:00 -05:00
filebot/installer/tar/update-filebot.sh

45 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/sh
PRG="$0"
# resolve relative symlinks
while [ -h "$PRG" ]; do
2015-06-29 08:04:34 -04:00
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
# make it fully qualified
PRG_DIR=`dirname "$PRG"`
2018-06-21 03:09:59 -04:00
FILEBOT_HOME=`cd "$PRG_DIR" && pwd`
2015-06-29 08:04:34 -04:00
# update core application files
PACKAGE_NAME="CHANGES.tar.xz"
PACKAGE_FILE="$FILEBOT_HOME/data/$PACKAGE_NAME"
PACKAGE_URL="@{link.release.index}/HEAD/$PACKAGE_NAME"
SIGNATURE_FILE="$PACKAGE_FILE.asc"
SIGNATURE_URL="$PACKAGE_URL.asc"
2015-06-29 08:04:34 -04:00
# use *.asc file to check for updates
echo "Update $PACKAGE_FILE"
HTTP_CODE=`curl -L -o "$SIGNATURE_FILE" -z "$SIGNATURE_FILE" --retry 5 "$SIGNATURE_URL" -w "%{http_code}"`
2015-06-29 08:04:34 -04:00
2017-06-08 18:35:28 -04:00
if [ $HTTP_CODE -ne 200 ]; then
echo "$HTTP_CODE NO UPDATE"
exit 1
fi
curl -L -o "$PACKAGE_FILE" -z "$PACKAGE_FILE" --retry 5 "$PACKAGE_URL"
# verify signature and extract tar
if gpgv --homedir "$FILEBOT_HOME" --keyring "maintainer.gpg" "$SIGNATURE_FILE" "$PACKAGE_FILE"; then
tar -C "$FILEBOT_HOME" -xvf "$PACKAGE_FILE"
fi