Adding update script (#525)

* Adding update script

Fix #389

* Update update.sh :)

* Make executable & update update.sh
This commit is contained in:
Jens Willmer 2018-10-22 18:08:03 +02:00 committed by Koen Kanters
parent 97cc56b691
commit e54de4bea7
2 changed files with 26 additions and 1 deletions

3
.gitignore vendored
View File

@ -62,4 +62,5 @@ data/database.db
data/config.json
data/log*.txt
data/state.json
data/log
data/log
data-backup/

24
update.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash -e
echo "Stopping zigbee2mqtt..."
sudo systemctl stop zigbee2mqtt
echo "Creating backup of configuration..."
cp -R data data-backup
echo "Updating..."
git checkout HEAD -- npm-shrinkwrap.json
git pull
echo "Installing dependencies..."
rm -rf node_modules
npm install
echo "Restore configuration..."
cp -R data-backup/* data
rm -rf data-backup
echo "Starting zigbee2mqtt..."
sudo systemctl start zigbee2mqtt
echo "Done!"