forked from pikvm/kvmd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkvmd.install
42 lines (34 loc) · 1.37 KB
/
kvmd.install
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
post_install() {
post_upgrade
}
post_upgrade() {
echo "==> Ensuring KVMD users and groups ..."
systemd-sysusers /usr/lib/sysusers.d/kvmd.conf
# https://github.com/systemd/systemd/issues/13522
for user in `grep '^u ' /usr/lib/sysusers.d/kvmd.conf | awk '{print $2}'`; do
usermod --expiredate= $user >/dev/null
done
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 [ ! -e /etc/kvmd/nginx/ssl/server.crt ]; then
echo "==> Generating KVMD-Nginx certificate ..."
kvmd-gencert --do-the-thing
fi
if [ ! -e /etc/kvmd/vnc/ssl/server.crt ]; then
echo "==> Generating KVMD-VNC certificate ..."
kvmd-gencert --do-the-thing --vnc
fi
for target in nginx vnc; do
chown root:root /etc/kvmd/$target/ssl
chown root:kvmd-$target /etc/kvmd/$target/ssl/*
chmod 440 /etc/kvmd/$target/ssl/server.key
chmod 444 /etc/kvmd/$target/ssl/server.crt
done
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
[ ! -f /etc/conf.d/rngd ] || (echo 'RNGD_OPTS="-o /dev/random -r /dev/hwrng -x jitter -x pkcs11 -x rtlsdr"' > /etc/conf.d/rngd)
}