summaryrefslogtreecommitdiffstats
path: root/core/modules/kiosk-chromium
diff options
context:
space:
mode:
authorJonathan Bauer2019-01-04 11:12:55 +0100
committerJonathan Bauer2019-01-04 11:12:55 +0100
commitf31f6e5fca75974adb1ae8300854916512b484bb (patch)
treec11c197a7fce4dcd41d30572cdd996d47509f746 /core/modules/kiosk-chromium
parent[beamergui] Close stdout/err when respawning beamergui (diff)
downloadmltk-f31f6e5fca75974adb1ae8300854916512b484bb.tar.gz
mltk-f31f6e5fca75974adb1ae8300854916512b484bb.tar.xz
mltk-f31f6e5fca75974adb1ae8300854916512b484bb.zip
[kiosk*] rework and introduce kiosk mode modules
changed from slxbrowser only support to modular hook structure to support additional browser, i.e. chromium NOTE: kiosk-chromium and kiosk-netpoint only make sense with the new gen
Diffstat (limited to 'core/modules/kiosk-chromium')
-rw-r--r--core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium91
-rw-r--r--core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-chromium-policies33
-rw-r--r--core/modules/kiosk-chromium/module.build12
-rw-r--r--core/modules/kiosk-chromium/module.conf5
4 files changed, 141 insertions, 0 deletions
diff --git a/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium b/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium
new file mode 100644
index 00000000..8221cadb
--- /dev/null
+++ b/core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium
@@ -0,0 +1,91 @@
+#!/bin/bash
+# prepares and run chromium as kiosk browser
+
+. /opt/openslx/config
+
+# swallow keyboard shortcuts of chromium
+cat <<- EOF > "$HOME/.xbindkeysrc"
+"true"
+ Control+d
+"true"
+ Control+t
+"true"
+ Control+s
+"true"
+ Control+n
+"true"
+ Control+j
+"true"
+ Control+p
+"true"
+ Control+h
+"true"
+ Control+Shift+o
+EOF
+# xbinkeys requires a daemon, run it
+xbindkeys_autostart &
+
+[ -n "$SLX_BROWSER_INSECURE" ] && SLX_BROWSER_INSECURE="--allow-running-insecure-content --ignore-certificate-errors"
+
+# clear state of previous sessions
+[ -e "$HOME/.config/chromium" ] && rm -rf -- "$HOME/.config/chromium"
+mkdir -p "$HOME/.config/chromium/Default"
+
+bookmark_template="$(mktemp)"
+cat <<-EOF > "$bookmark_template"
+{
+ "roots": {
+ "bookmark_bar": {
+ "children": [ ],
+ "id": "1",
+ "name": "Lesezeichenleiste",
+ "type": "folder"
+ },
+ "other": {
+ "children": [ ],
+ "id": "2",
+ "name": "Weitere Lesezeichen",
+ "type": "folder"
+ },
+ "synced": {
+ "children": [ ],
+ "id": "3",
+ "name": "Mobile Lesezeichen",
+ "type": "folder"
+ }
+ },
+ "version": 1
+}
+EOF
+
+# copy the Bookmark json template and fill in our bookmarks
+json_bookmarks() {
+ cur=0
+ echo -n '['
+ while [ $# -ne 0 ]; do
+ local bb="$1"
+ shift
+ awk -F, '{printf "%s","{\"id\": \"'$cur'\", \"type\": \"url\", \"name\": \""$1"\", \"url\": \""$2"\"}"}' <<< "$bb"
+ [ $# -ne 0 ] && echo -n ','
+ (( cur ++ ))
+ done
+ echo -n ']'
+}
+
+# set the bookmarks in the user's home directory
+jq ".roots.bookmark_bar.children += $(json_bookmarks $SLX_BROWSER_BOOKMARKS)" \
+ "$bookmark_template" > "$HOME/.config/chromium/Default/Bookmarks"
+
+if [ -n "$SLX_BROWSER_INTERACTIVE" ]; then
+ SLX_KIOSK=''
+else
+ SLX_KIOSK='--kiosk'
+fi
+
+# finally start chromium
+exec chromium-browser \
+ --noerrdialogs \
+ --disable-infobars \
+ $SLX_KIOSK \
+ $SLX_BROWSER_INSECURE \
+ "$SLX_BROWSER_URL"
diff --git a/core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-chromium-policies b/core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-chromium-policies
new file mode 100644
index 00000000..8b6a15d9
--- /dev/null
+++ b/core/modules/kiosk-chromium/data/opt/openslx/scripts/systemd-setup_kiosk.d/00-chromium-policies
@@ -0,0 +1,33 @@
+#!/bin/bash
+# ^SOURCED
+
+. /opt/openslx/config
+
+chromium_policies() {
+ # create managed policy file, those settings cannot be changed by the user
+ # (if he even gets to the settings dialog in the first place)
+ local chromium_policy_file="/etc/chromium-browser/policies/managed/kiosk-mode.json"
+ [ -e "$chromium_policy_file" ] && rm -f "$chromium_policy_file"
+
+ mkdir -p ${chromium_policy_file%/*}
+
+ if [ -n "$SLX_BROWSER_BOOKMARKS" ]; then
+ bookmarkbar=true
+ else
+ bookmarkbar=false
+ fi
+
+ cat <<- EOF > "$chromium_policy_file"
+ {
+ "BackgroundModeEnabled": false,
+ "BookmarkBarEnabled": $bookmarkbar,
+ "DefaultBrowserSettingEnabled": true,
+ "DownloadRestrictions": 3,
+ "ShowAppsShortcutInBookmarkBar": false,
+ "TranslateEnabled": false
+ }
+ EOF
+}
+
+chromium_policies
+true
diff --git a/core/modules/kiosk-chromium/module.build b/core/modules/kiosk-chromium/module.build
new file mode 100644
index 00000000..a5cbb6b6
--- /dev/null
+++ b/core/modules/kiosk-chromium/module.build
@@ -0,0 +1,12 @@
+#!/bin/bash
+fetch_source() {
+ :
+}
+
+build() {
+ :
+}
+
+post_copy() {
+ :
+}
diff --git a/core/modules/kiosk-chromium/module.conf b/core/modules/kiosk-chromium/module.conf
new file mode 100644
index 00000000..613d6d21
--- /dev/null
+++ b/core/modules/kiosk-chromium/module.conf
@@ -0,0 +1,5 @@
+#!/bin/bash
+REQUIRED_MODULES="kiosk-common"
+REQUIRED_BINARIES=""
+REQUIRED_LIBRARIES=""
+REQUIRED_DIRECTORIES=""