forked from home-assistant/hassbian-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_homeassistant.sh
29 lines (22 loc) · 946 Bytes
/
update_homeassistant.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
#!/bin/sh
echo
echo "Home Assistant update script for Hassbian"
echo "Created by Kent Calero <https://kentcalero.com>"
echo "Update steps taken from <https://home-assistant.io/getting-started/hassbian-common-tasks>"
echo "Portions of this script were borrowed from the Home Assistant install script for Hassbian by Fredrik Lindqvist Copyright(c) 2017 <https://github.im/Landrash>"
echo
echo "Stopping Home Assistant Service"
sudo systemctl stop [email protected]
echo "Changing to the homeassistant user"
sudo -u homeassistant -H /bin/bash << EOF
echo "Changing to Home Assistant venv"
source /srv/homeassistant/bin/activate
echo " Update to latest version of Home Assistant"
pip3 install --upgrade homeassistant
echo "Deactivating virtualenv"
deactivate
EOF
echo "Changing to the pi user"
sudo -u pi -H /bin/bash << EOF
echo "Starting Home Assistant Service"
sudo systemctl start [email protected]