Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 90 lines (72 sloc) 2.63 KB
#!/bin/bash -x
pack=(openbox unclutter xorg xutils xserver-xorg xinit xterm chromium-browser xserver-xorg-video-fbdev xserver-xorg-video-fbturbo ttf-dejavu lightdm )
user=monitor
######################## FUNCTION
function usage {
if [ "$1" == "" ]; then
echo "$0 braucht eine URL!"
return 1
fi
return 0
}
function install_PKG {
local PKG=$1
apt-get install -y ${PKG}
if [ $? != 0 ]; then
exit "apt-get install ${PKG} failed $?"
fi
}
function write_file {
local TEXT=$1
local FILE=$2
if [ -e ${FILE} ]; then
echo ${TEXT} >> ${FILE}
else
echo ${TEXT} > ${FILE}
fi
}
function failed {
local fin=$1
if [ ${fin} == 1 ]; then
EXIT "Command failed\n"
fi
}
########################## INSTALL
systemctl daemon-reload
usage $1
if [ $? = 1 ]; then
echo "Geben Sie eine vollstaendige URL ein(Bsp: http://www.bla.blub): "
read HTTP
else
HTTP=$1
fi
for value in ${pack[*]}
do
install_PKG ${value}
systemctl daemon-reexec
done
############################# CONFIG
useradd -mp ${user} ${user}
mkdir -pv /home/${user}/.config/openbox
write_file '#!/bin/bash' /home/${user}/.config/openbox/autostart
write_file 'xset s off' /home/${user}/.config/openbox/autostart
write_file 'xset -dpms' /home/${user}/.config/openbox/autostart
write_file 'xset s noblank' /home/${user}/.config/openbox/autostart
write_file "/home/${user}/start-kiosk.sh" /home/${user}/.config/openbox/autostart
if [ `hostname | cut -d. -f1` = "pifoyer" ]; then
write_file 'unclutter -idle 1 -jitter 2 -root &' /home/${user}/.config/openbox/autostart
write_file '#!/bin/bash' /home/${user}/start-kiosk.sh
write_file "sed -i 's/\"exited_cleanly\": false/\"exited_cleanly\": true/' ~/.config/chromium/Default/Preferences" /home/${user}/start-kiosk.sh
write_file "sed -i 's/\"exit_type\":\"Crashed\"/\"exit_type\":\"None\": true/' ~/.config/chromium/Default/Preferences" /home/${user}/start-kiosk.sh
write_file "chromium-browser --disk-cache-dir=/dev/null --noerrdialogs --kiosk ${HTTP}" /home/${user}/start-kiosk.sh
patch /boot/config.txt display.patch
else
write_file '#!/bin/bash' /home/${user}/start-kiosk.sh
write_file "sed -i 's/\"exited_cleanly\": false/\"exited_cleanly\": true/' ~/.config/chromium/Default/Preferences" /home/${user}/start-kiosk.sh
write_file "sed -i 's/\"exit_type\":\"Crashed\"/\"exit_type\":\"None\": true/' ~/.config/chromium/Default/Preferences" /home/${user}/start-kiosk.sh
write_file "chromium-browser --noerrdialogs --kiosk ${HTTP}" /home/${user}/start-kiosk.sh
fi
patch /etc/lightdm/lightdm.conf autologin.patch
chmod a+x /home/${user}/start-kiosk.sh /home/${user}/.config/openbox/autostart
chown -R ${user}:${user} /home/${user}/
shutdown -r now