summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorSimon Rettberg2019-11-12 14:43:08 +0100
committerSimon Rettberg2019-11-12 14:43:08 +0100
commite788c553ce17596d88cc3c16680adcfe4d763c57 (patch)
tree5f2c1576948989edf36321540df72326bd149faa /core
parent[vmware15] garantee single accept(OVF)?EULA lines (diff)
downloadmltk-e788c553ce17596d88cc3c16680adcfe4d763c57.tar.gz
mltk-e788c553ce17596d88cc3c16680adcfe4d763c57.tar.xz
mltk-e788c553ce17596d88cc3c16680adcfe4d763c57.zip
[kiosk-*] Support SLX_BROWSER, add precheck for browser binary
SLX_BROWSER is is space separated list of keywords. They are globbed within the kiosk-launch.d directory, so specifying SLX_BROWSER='chromium firefox' would first look for any file named *chromium* and source it, and if that fails for any file named *firefox*. If everything fails or the variable is empty, any file in that directory will be sourced.
Diffstat (limited to 'core')
-rw-r--r--core/modules/kiosk-chromium/data/opt/openslx/scripts/kiosk-launch.d/00-chromium4
-rwxr-xr-xcore/modules/kiosk-common/data/opt/openslx/scripts/kiosk-launch34
-rw-r--r--core/modules/kiosk-slxbrowser/data/opt/openslx/scripts/kiosk-launch.d/00-slxbrowser4
3 files changed, 36 insertions, 6 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
index 90064cf9..caf67ab9 100644
--- 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
@@ -1,7 +1,7 @@
-#!/bin/bash
+#!/bin/bash -- sourced
# prepares and run chromium as kiosk browser
-. /opt/openslx/config
+command -v chromium-browser || return 0
# clear state of previous sessions
[ -e "$HOME/.config/chromium" ] && rm -rf -- "$HOME/.config/chromium"
diff --git a/core/modules/kiosk-common/data/opt/openslx/scripts/kiosk-launch b/core/modules/kiosk-common/data/opt/openslx/scripts/kiosk-launch
index 43af3640..28dc6e19 100755
--- a/core/modules/kiosk-common/data/opt/openslx/scripts/kiosk-launch
+++ b/core/modules/kiosk-common/data/opt/openslx/scripts/kiosk-launch
@@ -13,14 +13,42 @@ xset -dpms
openbox --config-file "/etc/xdg/openbox/rc.xml.kiosk" &
# move the mouse away
-xdotool mousemove 20000 20000 &
+xdotool mousemove 20000 20000
-# run browser
+# Remember list of jobs running the background, so we can clean up
+# any mess left around by failed attempts below
+#
+#### Don't fork anything into background after this point
+#
+declare -rg BASE_JOBS="$(jobs -p)"
+
+kill_jobs() {
+ local j
+ for j in $(jobs -p); do
+ # Was already running before? Skip
+ [ " $BASE_JOBS " =~ " $j " ] && continue
+ kill "$j"
+ done
+}
+
+# try specific browser first, if any
+for browser in $SLX_BROWSER; do
+ [[ "$browser" =~ ^[a-zA-Z0-9_.\-]+$ ]] || continue
+ for file in "$0".d/*"$browser"*; do
+ [ -f "$file" ] || continue
+ . "$file" || slxlog "kiosk-launch" "Failed to source '$file'."
+ kill_jobs
+ done
+done
+# still here...
+# try anything
for file in "$0".d/*; do
+ [ -f "$file" ] || continue
. "$file" || slxlog "kiosk-launch" "Failed to source '$file'."
+ kill_jobs
done
# should not come to this point as above sources should
# exec away
-slxlog "kiosk-launch" "No kiosk browser configured!"
+slxlog --sync "kiosk-launch" "No kiosk browser configured/available!"
exit 1
diff --git a/core/modules/kiosk-slxbrowser/data/opt/openslx/scripts/kiosk-launch.d/00-slxbrowser b/core/modules/kiosk-slxbrowser/data/opt/openslx/scripts/kiosk-launch.d/00-slxbrowser
index 26fd6459..6d844b97 100644
--- a/core/modules/kiosk-slxbrowser/data/opt/openslx/scripts/kiosk-launch.d/00-slxbrowser
+++ b/core/modules/kiosk-slxbrowser/data/opt/openslx/scripts/kiosk-launch.d/00-slxbrowser
@@ -1,6 +1,8 @@
-#!/bin/ash
+#!/bin/bash
# ^ sourced!
+command -v slxbrowser || return 0
+
export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin
OPTS=