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 for target in nginx redirect-to-https ssl listen-http listen-https; do chmod 644 /etc/kvmd/nginx/$target.conf || true done 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 /etc/pacman.conf ] || sed -i -e "s|^Server = https://pikvm.org/repos/|Server = https://files.pikvm.org/repos/arch/|g" /etc/pacman.conf [ ! -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) # Some update deletes /etc/motd, WTF [ ! -f /etc/motd -a -f /etc/motd.pacsave ] && mv /etc/motd.pacsave /etc/motd }