aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Anavi <leon.anavi@konsulko.com>2016-11-24 14:05:52 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2016-11-25 15:31:15 +0000
commit0849ee91102f00e69260b6de17945378faf1064b (patch)
tree0007a60c8cbe99a3d372f025c81cc5d2bb386f8c
parent5da0f1afea662cc63fed03d0144bbdfbb3b3d2e4 (diff)
openivi-html5.sh: Configure HTML5 application
Select HTML5 application that should be loaded on boot (such as a homescreen) through the systemd service of openivi-html5. Following the recommendations of XDG base dir specification, the configuration file should be located at $XDG_CONFIG_DIRS/openivi-html5/openivi-html5.ini and it should contain value for homescreen with path to HTML file. If the configuration file does not exist or if the HTML does not exist then openivi-html5 will load the following sample HTML5 by default: /usr/share/openivi/example/cluster/index.html Bug-AGL: SPEC-332 Change-Id: I496b0ccbcb09f8964042f9d07abad2d552376b80 Signed-off-by: Leon Anavi <leon.anavi@konsulko.com>
-rw-r--r--recipes-openivi/openivi-html5/openivi-html5/openivi-html5.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/recipes-openivi/openivi-html5/openivi-html5/openivi-html5.sh b/recipes-openivi/openivi-html5/openivi-html5/openivi-html5.sh
index ed8a56144..190ab653d 100644
--- a/recipes-openivi/openivi-html5/openivi-html5/openivi-html5.sh
+++ b/recipes-openivi/openivi-html5/openivi-html5/openivi-html5.sh
@@ -1,9 +1,25 @@
#!/bin/sh
+if test -z "$XDG_CONFIG_DIRS"; then
+ export XDG_CONFIG_DIRS=/etc/xdg/
+fi
+
if test -z "$XDG_RUNTIME_DIR"; then
export XDG_RUNTIME_DIR=/run/user/$UID
mkdir --parents $XDG_RUNTIME_DIR
chmod 0700 $XDG_RUNTIME_DIR
fi
-/usr/bin/openivi-html5 -f -u /usr/share/openivi/example/cluster/index.html
+# Default homescreen
+HOMESCREEN=/usr/share/openivi/example/cluster/index.html
+
+# Read configuration
+HOMESCREEN_CONFIG=$XDG_CONFIG_DIRS/openivi-html5/openivi-html5.ini
+if [ -e "$HOMESCREEN_CONFIG" ] ; then
+ HTML=`sed -n '/^homescreen=\(.*\)$/s//\1/p' < $HOMESCREEN_CONFIG`
+ if [ -e "$HTML" ] ; then
+ HOMESCREEN=$HTML
+ fi
+fi
+
+/usr/bin/openivi-html5 -f -u $HOMESCREEN