summaryrefslogtreecommitdiff
path: root/kvmd.install
blob: db2cb3a31ed75d1ea960c1b693d364c2cea7d67a (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
30
31
32
33
34
35
post_install() {
	post_upgrade

	echo "==> Generating KVMD-Nginx certificate ..."
	kvmd-gencert --do-the-thing
}

post_upgrade() {
	echo "==> Ensuring KVMD users and groups ..."
	systemd-sysusers /usr/lib/sysusers.d/kvmd.conf

	# https://github.com/systemd/systemd/issues/13522
	usermod --expiredate= kvmd >/dev/null

	chown kvmd:kvmd /etc/kvmd/htpasswd
	chown kvmd-ipmi:kvmd-ipmi /etc/kvmd/ipmipasswd
	chown kvmd-vnc:kvmd-vnc /etc/kvmd/vncpasswd
	chmod 600 /etc/kvmd/*passwd

	chown kvmd /var/lib/kvmd/msd || true

	if [ ! -d /etc/kvmd/vnc/ssl ]; then
		echo "==> Generating KVMD-VNC certificate ..."
		kvmd-gencert --do-the-thing --vnc
	fi

	chown root:root /etc/kvmd/vnc/ssl
	chown root:root /etc/kvmd/nginx/ssl
	chmod 755 /etc/kvmd/vnc/ssl
	chmod 755 /etc/kvmd/nginx/ssl

	echo "==> Patching configs ..."
	[ ! -f /boot/config.txt ] || sed -i -e 's/^dtoverlay=pi3-disable-bt$/dtoverlay=disable-bt/g' /boot/config.txt
	[ ! -f /boot/config.txt ] || sed -i -e 's/^dtoverlay=dwc2$/dtoverlay=dwc2,dr_mode=peripheral/g' /boot/config.txt
}