summarylogtreecommitdiffstats
path: root/homebridge.install
blob: 77f8cac04588304b7dfbab8f7cfb4b144d576b4e (plain)
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
_NAME=homebridge

post_install() {
	mkdir -p /var/lib/${_NAME}
	getent passwd ${_NAME} > /dev/null || useradd -d /var/lib/${_NAME} -s /bin/false -r ${_NAME} > /dev/null
	chown -R ${_NAME}:${_NAME} /var/lib/${_NAME}

	echo ""
	echo "A sample configuration file is provided at /usr/lib/node_modules/homebridge/config-sample.json"
	echo "Copy this to /var/lib/${_NAME}/config.json and edit accordingly"
	echo "  cp /usr/lib/node_modules/homebridge/config-sample.json /var/lib/${_NAME}/config.json"
	echo "  chown ${_NAME}:${_NAME} /var/lib/${_NAME}/config.json"
	echo "  \$EDITOR /var/lib/${_NAME}/config.json"
	echo ""
	echo "You can then start the service as follows:"
	echo "  systemctl start homebridge"
	echo ""
	echo "If you get a DNS related error on startup, make sure avahi-daemon is running (systemctl status -l avahi-daemon.service)"
	echo ""
}

post_upgrade() {
	post_install
}

post_remove() {
	echo "Some files have not been removed because they are created by ${_NAME} itself."
	userdel -f ${_NAME}
}