photoprism-slideshow/update.sh

21 lines
816 B
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
LATEST_RELEASE=$(curl -X 'GET' -H 'accept: application/json' 'https://phlaym.net/git/api/v1/repos/phlaym/photoprism-slideshow/releases' | jq .[0].tag_name -r)
CURRENT=$(cat version.txt 2> /dev/null)
SUCCESS=$?
if [[ $SUCCESS != 0 ]]
then
CURRENT='v0.0.0'
fi
if [[ $LATEST_RELEASE == $CURRENT || $LATEST_RELEASE < $CURRENT ]]
then
echo "New version ${LATEST_RELEASE} is up to date with currently installed ${CURRENT}"
exit
fi
echo "New version '${LATEST_RELEASE}' detected, updating from '${CURRENT}'"
sudo -u www-data wget "https://phlaym.net/git/phlaym/photoprism-slideshow/archive/${LATEST_RELEASE}.tar.gz" -O release.tar.gz
sudo -u www-data tar xvf release.tar.gz --strip-components=1
sudo -u www-data composer install
sudo -u www-data rm release.tar.gz
echo $LATEST_RELEASE > version.txt