2018-06-27 14:43:21 -04:00
|
|
|
#!/bin/sh
|
2014-06-20 14:41:18 -04:00
|
|
|
PRG="$0"
|
2014-03-26 03:06:39 -04:00
|
|
|
|
2014-06-20 14:41:18 -04:00
|
|
|
# resolve relative symlinks
|
2016-06-08 08:31:16 -04:00
|
|
|
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
|
2014-06-20 14:41:18 -04:00
|
|
|
done
|
|
|
|
|
|
|
|
# make it fully qualified
|
|
|
|
PRG_DIR=`dirname "$PRG"`
|
2018-06-21 03:09:59 -04:00
|
|
|
FILEBOT_HOME=`cd "$PRG_DIR" && pwd`
|
2014-06-20 14:41:18 -04:00
|
|
|
|
|
|
|
|
2015-06-29 08:04:34 -04:00
|
|
|
# update core application files
|
2018-06-27 14:23:02 -04:00
|
|
|
PACKAGE_NAME="CHANGES.tar.xz"
|
2018-06-27 15:02:11 -04:00
|
|
|
PACKAGE_FILE="$FILEBOT_HOME/data/$PACKAGE_NAME"
|
2018-06-26 08:28:29 -04:00
|
|
|
PACKAGE_URL="@{link.release.index}/HEAD/$PACKAGE_NAME"
|
2018-06-27 14:23:02 -04:00
|
|
|
|
2018-06-26 08:28:29 -04:00
|
|
|
SIGNATURE_FILE="$PACKAGE_FILE.asc"
|
|
|
|
SIGNATURE_URL="$PACKAGE_URL.asc"
|
2015-06-29 08:04:34 -04:00
|
|
|
|
2018-06-27 14:43:21 -04:00
|
|
|
|
2018-06-26 08:28:29 -04:00
|
|
|
# use *.asc file to check for updates
|
2017-04-13 05:54:09 -04:00
|
|
|
echo "Update $PACKAGE_FILE"
|
2018-06-26 08:28:29 -04:00
|
|
|
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"
|
2016-06-08 08:31:16 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
2016-10-24 16:17:47 -04:00
|
|
|
|
2018-06-27 14:23:02 -04:00
|
|
|
curl -L -o "$PACKAGE_FILE" -z "$PACKAGE_FILE" --retry 5 "$PACKAGE_URL"
|
2018-06-26 08:28:29 -04:00
|
|
|
|
2017-04-13 05:54:09 -04:00
|
|
|
|
2018-06-26 08:28:29 -04:00
|
|
|
# verify signature and extract tar
|
2018-06-27 14:43:21 -04:00
|
|
|
if gpgv --homedir "$FILEBOT_HOME" --keyring "maintainer.gpg" "$SIGNATURE_FILE" "$PACKAGE_FILE"; then
|
2018-06-27 14:23:02 -04:00
|
|
|
tar -xvf "$PACKAGE_FILE"
|
2018-06-26 08:28:29 -04:00
|
|
|
fi
|