post_install() {
 useradd -d /var/lib/infoscreen -M -U -s /bin/bash infoscreen
 chown -R infoscreen:infoscreen /var/lib/infoscreen
 chmod -R o= /var/lib/infoscreen
 gpasswd -a infoscreen users
 gpasswd -a infoscreen audio
 gpasswd -a infoscreen video
 gpasswd -a infoscreen uucp

 getent group salt &> /dev/null || groupadd salt
 gpasswd -a infoscreen salt

 modprobe cdc_acm
 
 post_upgrade
}


_stop_tty() {
 systemctl stop getty@tty1.service
 killall -u infoscreen &> /dev/null || true
 sleep 1
 killall -9 -u infoscreen &> /dev/null || true
}


_restart_tty() {
 systemctl --system daemon-reload
 systemctl restart getty@tty1.service
}


pre_upgrade() {
 _stop_tty
}


post_upgrade() {
 fc-cache -fs
 _restart_tty
}


pre_remove() {
 _stop_tty
 userdel -r infoscreen
}


post_remove() {
 fc-cache -fs
 _restart_tty
}
