2018-10-22 09:08:03 -07:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2020-10-28 02:45:49 -07:00
|
|
|
if [ -d data-backup ]; then
|
|
|
|
echo "ERROR: Backup directory exists. May be previous restoring was failed?"
|
|
|
|
echo "1. Save 'data-backup' and 'data' dirs to safe location to make possibility to restore config later."
|
|
|
|
echo "2. Manually delete 'data-backup' dir and try again."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-08-01 01:36:20 -07:00
|
|
|
echo "Stopping Zigbee2MQTT..."
|
2018-10-22 09:08:03 -07:00
|
|
|
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..."
|
2020-02-13 13:31:14 -07:00
|
|
|
npm ci
|
2018-10-22 09:08:03 -07:00
|
|
|
|
|
|
|
echo "Restore configuration..."
|
|
|
|
cp -R data-backup/* data
|
|
|
|
rm -rf data-backup
|
|
|
|
|
2020-08-01 01:36:20 -07:00
|
|
|
echo "Starting Zigbee2MQTT..."
|
2018-10-22 09:08:03 -07:00
|
|
|
sudo systemctl start zigbee2mqtt
|
|
|
|
|
|
|
|
echo "Done!"
|