Skip to content

Instantly share code, notes, and snippets.

@eladc

eladc/cb-updatev4

Last active Jan 1, 2019
Embed
What would you like to do?
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