diff --git a/installer/portable/update-filebot.sh b/installer/portable/update-filebot.sh index 3b1fac89..ecc4d822 100755 --- a/installer/portable/update-filebot.sh +++ b/installer/portable/update-filebot.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -xu PRG="$0" # resolve relative symlinks @@ -18,18 +18,23 @@ FILEBOT_HOME=`cd "$PRG_DIR" && pwd` # update core application files -PACKAGE_NAME="CHANGES.tar.xz.gpg" +PACKAGE_NAME="DELTA.tar.xz" PACKAGE_FILE="$FILEBOT_HOME/$PACKAGE_NAME" -PACKAGE_URL="https://get.filebot.net/filebot/latest/$PACKAGE_NAME" +PACKAGE_URL="@{link.release.index}/HEAD/$PACKAGE_NAME" +SIGNATURE_FILE="$PACKAGE_FILE.asc" +SIGNATURE_URL="$PACKAGE_URL.asc" +# use *.asc file to check for updates echo "Update $PACKAGE_FILE" -HTTP_CODE=`curl -L -o "$PACKAGE_FILE" -z "$PACKAGE_FILE" --retry 5 "$PACKAGE_URL" -w "%{http_code}"` +HTTP_CODE=`curl -L -o "$SIGNATURE_FILE" -z "$SIGNATURE_FILE" --retry 5 "$SIGNATURE_URL" -w "%{http_code}"` if [ $HTTP_CODE -ne 200 ]; then echo "$HTTP_CODE NO UPDATE" exit 1 fi +curl -L -o "$PACKAGE_FILE" --retry 5 "$PACKAGE_URL" + # initialize gpg GPG_HOME="$FILEBOT_HOME/data/.gpg" @@ -38,5 +43,7 @@ if [ ! -d "$GPG_HOME" ]; then mkdir -p "$GPG_HOME" && chmod 700 "$GPG_HOME" && gpg --homedir "$GPG_HOME" --import "$FILEBOT_HOME/maintainer.pub" fi -# verify signature and extract jar -gpg --batch --yes --homedir "$GPG_HOME" --trusted-key "4E402EBF7C3C6A71" --decrypt "$PACKAGE_FILE" | tar -xJvf "-" +# verify signature and extract tar +if gpg --batch --yes --homedir "$GPG_HOME" --trusted-key "B0976E51E5C047AD0FD051294E402EBF7C3C6A71" --verify "$SIGNATURE_FILE" "$PACKAGE_FILE"; then + tar -xJvf "$PACKAGE_FILE" && rm -v "$PACKAGE_FILE" +fi