#!/bin/bash
# install necessary packages
apt-get -y install enscript feh ghostscript gsfonts imagemagick imagemagick-6-common imagemagick-6.q16 libjpeg9 libjpeg-progs libjxr0:armhf libjxr-tools liblqr-1-0 libmagickcore-6.q16-3 libmagickcore-6.q16-3-extra libmagickwand-6.q16-3 libnetpbm10 libwmf0.2-7 netpbm poppler-utils python3-magic python-magic rclone zsh zsh-common
# fix cursor and screensaver
/home/pi/kiosk/bin/change-file a /etc/lightdm/lightdm.conf 'xserver-command=X -nocursor -s 0 dpms'
/home/pi/kiosk/bin/change-file a /etc/xdg/lxsession/LXDE/autostart '@xset s noblank' '@xset s off' '@xset -dpms'
# make it start on boot
/home/pi/kiosk/bin/change-file c /etc/rc.local 'exit 0' '#exit 0'
/home/pi/kiosk/bin/change-file a /etc/rc.local 'sleep 5' 'sudo -u pi /home/pi/kiosk/bin/show' 'exit 0'
# make sure Raspberry Pi is caught up on all updates
apt-get -y update
apt-get -y dist-upgrade
# reboot the system
echo rebooting
sleep 9
sync
sync
sync
sleep 9
/sbin/reboot