Kiosk Mode (Jessie)

Raspberry Pi als "Kiosk Mode"

Basis-Installation

1) Debian (Raspbian) Jessie Lite Image installieren

2) Aktualisieren und Grundeinstellungen vornehmen (Sprache, Zeitzone, …):

sudo apt-get update
sudo apt-get upgrade

# ggf. rpi-update noch installieren (wenn es fehlt)
# => Aktualisierung /boot (Firmware), alte FW liegt in /boot.bak
sudo apt-get install rpi-update
sudo rpi-update

sudo raspi-config

dpkg-reconfigure locales # de_DE.UTF-8 wählen als Standard
dpkg-reconfigure tzdata  # Europe => Berlin

3) Einige „Standard-Programme / Tools“ nachinstallieren

sudo apt-get install nano joe 
sudo apt-get install tree file 
sudo apt-get install apt-utils
sudo apt-get install man

4) Basis-Installation für X

sudo apt-get install matchbox 
sudo apt-get install x11-xserver-utils 
sudo apt-get install ttf-mscorefonts-installer 
sudo apt-get install xwit 
sudo apt-get install sqlite3 
sudo apt-get install libnss3

5) Weitere Pakete installieren

sudo apt-get install su
sudo apt-get install xinit
sudo apt-get install xserver-xorg
sudo apt-get install xserver-xorg-legacy

6a) Installation chromium-browser

sudo apt-get install chromium-browser 

Wenn das so nicht funktioniert, weil irgendwelche abgespeckte / veränderten Sourcen verwendet werden (z.B. Problem bei Volumio), behelfe man sich ggf. so:

6b)

apt-get download chromium-browser
dpkg -i --ignore-depends=libraspberrypi0 chromium-browser_56.0.2924.84-0ubuntu0.14.04.1.1000_armhf.deb
apt-get install gconf-service  libgconf-2-4 libxss1 libxcb-image0 xdg-utils

ggf. wäre es sinnvoller, das chromium-browser Paket zu bearbeiten und die Abhängigkeit raus zu nehmen.

6c) Installation gepatchtes Paket (Abhängigkeit entfernt):

wget https://www.to-st.de/download/linux/raspian/chromium-browser_56.0.2924.84-0ubuntu0.14.04.1.1000_armhf.deb
dpkg -i chromium-browser_56.0.2924.84-0ubuntu0.14.04.1.1000_armhf.deb
apt-get -f install

Dateien:

7) Danach die Datei /etc/X11/Xwrapper.config bearbeiten:

 sudo joe /etc/X11/Xwrapper.config 
# Xwrapper.config (Debian X Window System server wrapper configuration file)
#
# This file was generated by the post-installation script of the
# xserver-xorg-legacy package using values from the debconf database.
#
# See the Xwrapper.config(5) manual page for more information.
#
# This file is automatically updated on upgrades of the xserver-xorg-legacy
# package *only* if it has not been modified since the last upgrade of that
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command as root:
#   dpkg-reconfigure xserver-xorg-legacy
allowed_users=anybody
needs_root_rights=yes

7. Verzeichnis für Client-Config im DOS/Windows-Verzeichnis anlegen (im System /boot)

sudo mkdir /boot/client-cfg
cd /boot/client-cfg

8. Hostnamen festlegen in hostname.txt

joe hostname.txt

9. xinitrc festlegen

joe xinitrc

und in etwas folgenden Inhalt einkopieren:

#!/bin/sh

while true; do

	# Clean up previously running apps, gracefully at first then harshly
	killall -TERM chromium 2>/dev/null;
	killall -TERM matchbox-window-manager 2>/dev/null;
	sleep 2;
	killall -9 chromium 2>/dev/null;
	killall -9 matchbox-window-manager 2>/dev/null;

	# Clean out existing profile information
	rm -rf /home/pi/.cache;
	rm -rf /home/pi/.config;
	rm -rf /home/pi/.pki;

	# Generate the bare minimum to keep Chromium happy!
	mkdir -p /home/pi/.config/chromium/Default
	sqlite3 /home/pi/.config/chromium/Default/Web\ Data "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); INSERT INTO meta VALUES('version','46'); CREATE TABLE keywords (foo INTEGER);";

	# Disable DPMS / Screen blanking
	xset -dpms
	xset s off

	# Reset the framebuffer's colour-depth
	fbset -depth $( cat /sys/module/*fb*/parameters/fbdepth );

	# Hide the cursor (move it to the bottom-right, comment out if you want mouse interaction)
	# xwit -root -warp $( cat /sys/module/*fb*/parameters/fbwidth ) $( cat /sys/module/*fb*/parameters/fbheight )

	# Start the window manager (remove "-use_cursor no" if you actually want mouse interaction)
	# matchbox-window-manager -use_titlebar no -use_cursor no &
	matchbox-window-manager -use_titlebar no &

	# Start the browser (See http://peter.sh/experiments/chromium-command-line-switches/)
	chromium-browser  --app="http://192.168.0.51:8080/guacamole/"

done;

Achtung!
Pfade anpassen!
z.B. /home/pi/ vs. /home/volumio/

10. Die Datei /etc/rc.local anpassen, hier werden die Änderungen aus den Client-Config Dateien angewendet:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel. 
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

# set hostname
if [ -f /boot/client-cfg/hostname.txt ]; then  
  hostname --file /boot/client-cfg/hostname.txt
fi

# start X environment
if [ -f /boot/client-cfg/xinitrc ]; then
        ln -fs /boot/client-cfg/xinitrc /home/pi/.xinitrc;
        su -l pi -s /bin/bash -c 'startx' &
fi
  
exit 0

Achtung!
Benutzernamen und Pfade anpassen!
z.B. /home/pi/ vs. /home/volumio/
pi vs. volumio