forked from Koenkk/zigbee2mqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.sh
executable file
·45 lines (38 loc) · 1.01 KB
/
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
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
cd "$(dirname "$0")"
NEED_RESTART=0
OSNAME="$(uname -s)"
if [ "$OSNAME" == "FreeBSD" ]; then
echo "Checking Zigbee2MQTT status..."
if service zigbee2mqtt status >/dev/null; then
echo "Stopping Zigbee2MQTT..."
service zigbee2mqtt stop
NEED_RESTART=1
fi
else
if which systemctl 2> /dev/null > /dev/null; then
echo "Checking Zigbee2MQTT status..."
if systemctl is-active --quiet zigbee2mqtt; then
echo "Stopping Zigbee2MQTT..."
sudo systemctl stop zigbee2mqtt
NEED_RESTART=1
fi
else
echo "Skipped stopping Zigbee2MQTT, no systemctl found"
fi
fi
echo "Updating..."
git pull --no-rebase
echo "Installing dependencies..."
pnpm i --frozen-lockfile
echo "Building..."
pnpm run build
if [ $NEED_RESTART -eq 1 ]; then
echo "Starting Zigbee2MQTT..."
if [ "$OSNAME" == "FreeBSD" ]; then
service zigbee2mqtt start
else
sudo systemctl start zigbee2mqtt
fi
fi
echo "Done!"