Skip to content

Instantly share code, notes, and snippets.

@eladc
Last active January 1, 2019 18:09
Show Gist options
  • Save eladc/f3e3f7c3c5a4f105fbd90b28dd7a8fa5 to your computer and use it in GitHub Desktop.
Save eladc/f3e3f7c3c5a4f105fbd90b28dd7a8fa5 to your computer and use it in GitHub Desktop.
cb update v1
#!/bin/bash
## update sudoers file
sed -e 's#%sudo.*#&,NOPASSWD: /bin/systemctl#' /etc/sudoers > /tmp/sd ; > /etc/sudoers ; cat /tmp/sd | EDITOR='tee -a' visudo
## add a service restart in update script
sed -i '/xf/a\ sudo systemctl restart cleanbox' /opt/cleanbox/update-new.sh
## remove service restart from root
sed -i '$ d' /var/spool/cron/crontabs/root
## fix beeper
cat << EOF > /home/kiosk/beeper
#!/bin/bash
function getID()
{
ID=\$(xinput | grep Touch | cut -f2 -d= | awk '{print $1}' | sort -g | head -n1)
}
xinput test-xi2 --root \$ID \
| grep --line-buffered "EVENT type 22 (RawTouchBegin)" | \
while read line;do getID; paplay /home/kiosk/pop.ogg ;done
EOF
## restart beeper
pkill -f beeper
su -c /home/kiosk/beeper kiosk &
## fix xscreensaver
cat << EOF > /home/kiosk/chk-xsv.sh
#!/bin/bash
PID=\$(ps aux | pgrep xscreensaver)
if [ -z "\$PID" ];then
/usr/share/xscreensaver/xscreensaver-wrapper.sh -nosplash &
fi
EOF
chown kiosk:kiosk /home/kiosk/chk-xsv.sh
chmod +x /home/kiosk/chk-xsv.sh
echo "0 * * * * bash /home/kiosk/chk-xsv.sh" >> /var/spool/cron/crontabs/kiosk
## hide cursor
sed -i 's/xserver.*/& -nocursor/' /usr/share/lightdm/lightdm.conf.d/50-xserver-command.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment