post_install() { echo "(Re)creating group and user ..." getent passwd g13 > /dev/null 2>&1 || useradd -c 'Logitech G13 daemon' -G wheel -d /run/g13d -s /usr/bin/nologin -r g13 passwd -l g13 > /dev/null echo "Adding user to input group" gpasswd -a g13 input echo "(Re)creating tmpfiles ..." systemd-tmpfiles --create /usr/lib/tmpfiles.d/g13.conf echo "NOTE: Uncomment lines in /usr/lib/udev/rules.d/91-g13.rules to start g13 systemd service when G13 is connected" echo " and add commands to /etc/g13/default.bind for initial configuration (see /usr/share/doc/g13-git/examples)" echo " Location of g13d input fifo has moved from /tmp/g13-0 to /run/g13d/g13-0" } post_upgrade() { post_install } pre_remove() { echo "Removing tmpfiles ..." systemd-tmpfiles --remove /usr/lib/tmpfiles.d/g13.conf } post_remove() { echo "Making sure the g13d service is not running ..." systemctl stop g13 echo "Removing user from input group ..." gpasswd -d g13 input echo "Removing user and group ..." getent passwd g13 > /dev/null 2>&1 && userdel g13 }