Files
grocy/update.sh

35 lines
925 B
Bash
Raw Normal View History

2018-07-25 08:22:27 +02:00
#!/bin/bash
GROCY_RELEASE_URL=https://releases.grocy.info/latest
echo Start updating grocy
set -e
shopt -s extglob
pushd `dirname $0` > /dev/null
backupBundleFileName="backup-`date +%d-%m-%Y-%H-%M-%S`.tgz"
2019-07-14 13:02:21 +02:00
echo Making a backup of the current installation in ./data/backups/$backupBundleFileName
2018-07-25 08:22:27 +02:00
mkdir -p ./data/backups > /dev/null
tar -zcvf ./data/backups/$backupBundleFileName --exclude ./data/backups . > /dev/null
find ./data/backups/*.tgz -mtime +60 -type f -delete
2019-07-14 13:02:21 +02:00
echo Deleting everything except ./data and this script
2018-07-25 08:22:27 +02:00
rm -rf !(data|update.sh) > /dev/null
2019-07-14 13:02:21 +02:00
echo Emptying ./data/viewcache
2018-07-25 08:22:27 +02:00
rm -rf ./data/viewcache/* > /dev/null
echo Downloading latest release
rm -f ./grocy-latest.zip > /dev/null
wget $GROCY_RELEASE_URL -q -O ./grocy-latest.zip > /dev/null
echo Unzipping latest release
unzip -o ./grocy-latest.zip > /dev/null
rm -f ./grocy-latest.zip > /dev/null
popd > /dev/null
echo Finished updating grocy