-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathinstall.sh
49 lines (40 loc) · 1.33 KB
/
install.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
46
47
48
49
#!/bin/bash
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt install -y nodejs libavahi-compat-libdnssd-dev
[ ! -d ~/.homebridge ] && mkdir ~/.homebridge && cp config.json ~/.homebridge
sudo npm i -g --unsafe-perm homebridge homebridge-config-ui-x
sudo bash -c "cat > /etc/systemd/system/homebridge-config-ui-x.service" << EOL
[Unit]
Description=Homebridge Config UI X
After=syslog.target network-online.target
[Service]
Type=simple
User=$USER
ExecStart=$(which homebridge-config-ui-x) -U $HOME/.homebridge -I
Restart=on-failure
RestartSec=3
KillMode=process
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_BIND_SERVICE CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_CHOWN CAP_FOWNER CAP_DAC_OVERRIDE CAP_AUDIT_WRITE CAP_SYS_ADMIN
AmbientCapabilities=CAP_NET_RAW
[Install]
WantedBy=multi-user.target
EOL
sudo bash -c "cat > /etc/systemd/system/homebridge.service" << EOL
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
User=$USER
ExecStart=$(which homebridge) -U $HOME/.homebridge -I
Restart=on-failure
RestartSec=3
KillMode=process
[Install]
WantedBy=multi-user.target
EOL
sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge
sudo systemctl enable homebridge-config-ui-x
sudo systemctl start homebridge-config-ui-x