summaryrefslogtreecommitdiffstats
path: root/web-gui/login/run.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'web-gui/login/run.sh.in')
-rwxr-xr-xweb-gui/login/run.sh.in73
1 files changed, 73 insertions, 0 deletions
diff --git a/web-gui/login/run.sh.in b/web-gui/login/run.sh.in
new file mode 100755
index 0000000..9154591
--- /dev/null
+++ b/web-gui/login/run.sh.in
@@ -0,0 +1,73 @@
+#!/bin/bash
+#
+# json dbus bridge
+#
+# Copyright (c) 2010 by Michael Olbrich <m.olbrich@pengutronix.de>
+#
+# To the extent possible under law, Pengutronix e.K. has waived all copyright
+# and related or neighboring rights to JSON-DBus-Bridge Demo Code.
+#
+
+if [ "`whoami`" != "root" ]; then
+ echo This script must be run by root.
+fi
+
+if [ ! -f "@abs_builddir@/build/index.html" ]; then
+ echo
+ echo 'You must run "make" before running this script'
+ echo
+ exit 1
+fi
+
+finish() {
+ kill $hello_pid
+ kill $lighttpd_pid
+ kill $jdb_user_pid
+ kill $jdb_admin_pid
+ kill $DBUS_SESSION_BUS_PID
+ exit
+}
+
+trap finish SIGINT
+
+eval `su -c "dbus-launch --config-file='@abs_builddir@/dbus-session.conf' --sh-syntax" @LIGHTTPD_USER@`
+
+su -c "@abs_top_srcdir@/services/python/hello-world.py" @LIGHTTPD_USER@ &
+hello_pid=$!
+
+su -c "'@JSON_DBUS_BRIDGE@' '/tmp/json-dbus-bridge.user.socket'" @USER_ROLE@ &
+jdb_user_pid=$!
+
+su -c "'@JSON_DBUS_BRIDGE@' '/tmp/json-dbus-bridge.admin.socket'" @ADMIN_ROLE@ &
+jdb_admin_pid=$!
+sleep 0.5
+chmod a+rw '/tmp/json-dbus-bridge.admin.socket'
+
+su -c "@LIGHTTPD@ -f '@abs_builddir@/lighttpd.conf' -D" @LIGHTTPD_USER@ &
+lighttpd_pid=$!
+
+echo -n "waiting for lighttpd "
+for i in `seq 10`; do
+ sleep 1
+ echo -n "."
+ wget -e no_proxy=localhost -O - -q http://localhost:8080/ > /dev/null && break
+done
+
+if [ $? -ne 0 ]; then
+ echo
+ echo
+ echo starting lighttpd failed!
+ finish
+ exit 1
+else
+ echo
+ echo
+ echo lighttpd sucessfully started.
+ echo
+ echo The demo page can be view at http://localhost:8080/
+fi
+
+while [ 1 ]; do
+ sleep 100
+done
+