forked from grocy/grocy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·35 lines (24 loc) · 968 Bytes
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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"
echo Making a backup of the current installation in ./data/backups/$backupBundleFileName
mkdir -p ./data/backups > /dev/null
touch ./data/backups/$backupBundleFileName
tar -zcvf ./data/backups/$backupBundleFileName --exclude ./data/backups . > /dev/null
find ./data/backups/*.tgz -mtime +60 -type f -delete
echo Deleting everything except ./data and this script
rm -rf !(data|update.sh) > /dev/null
echo Emptying ./data/viewcache
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