changeset 738:ea8d13590cbd

Added trustbridge-tray-starter script for use with cron job. TODO: trustbridge must safe $DISPLAY in $CFGDIR/trustbridge-tray-starter.cfg
author Sascha Wilde <wilde@intevation.de>
date Fri, 04 Jul 2014 12:32:51 +0200
parents a26aada5900f
children 5f0fca113ff4
files packaging/linux-createpackage.sh.in packaging/linux-installer.inc.in ui/CMakeLists.txt ui/trustbridge-tray-starter.sh
diffstat 4 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/packaging/linux-createpackage.sh.in	Thu Jul 03 17:08:22 2014 +0200
+++ b/packaging/linux-createpackage.sh.in	Fri Jul 04 12:32:51 2014 +0200
@@ -13,7 +13,8 @@
 
 EXEFILES=("@CMAKE_BINARY_DIR@/cinst/cinst"
           "@CMAKE_BINARY_DIR@/cinst/mozilla"
-          "@CMAKE_BINARY_DIR@/ui/trustbridge")
+          "@CMAKE_BINARY_DIR@/ui/trustbridge"
+          "@CMAKE_BINARY_DIR@/ui/trustbridge-tray-starter.sh")
 
 # Make installation in TMPDIR, this is what we will put into the
 # shar-archive.
--- a/packaging/linux-installer.inc.in	Thu Jul 03 17:08:22 2014 +0200
+++ b/packaging/linux-installer.inc.in	Fri Jul 04 12:32:51 2014 +0200
@@ -307,6 +307,12 @@
 ###SHAR###
 # ----------------------------------------------------------------------
 
+echo "Preparing trustbridge-tray-starter ..."
+sed -i "/^PREFIX=/c\PREFIX='${instcfg[PREFIX]}'" \
+    "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
+sed -i "/^CFGDIR=/c\CFGDIR='${instcfg_path}'" \
+    "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
+
 echo "Writing installation configuration to: $instcfg_file ..."
 write_instcfg
 exit 0
--- a/ui/CMakeLists.txt	Thu Jul 03 17:08:22 2014 +0200
+++ b/ui/CMakeLists.txt	Fri Jul 04 12:32:51 2014 +0200
@@ -201,9 +201,12 @@
    ${EXTRA_STATIC_LIBS}
    ${PROFILING_LIBS})
 
-
 # Tests
 add_subdirectory(tests)
 
 install(TARGETS trustbridge DESTINATION bin)
 install(TARGETS trustbridge-admin DESTINATION bin)
+if(UNIX)
+  configure_file(trustbridge-tray-starter.sh trustbridge-tray-starter.sh COPYONLY)
+  install(FILES trustbridge-tray-starter.sh DESTINATION bin)
+endif()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ui/trustbridge-tray-starter.sh	Fri Jul 04 12:32:51 2014 +0200
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+PREFIX=""
+CFGDIR=""
+TBCMD="trustbridge --tray"
+XSET=/usr/bin/xset
+CONFIG="$CFGDIR/trustbridge-tray-starter.cfg"
+
+if [ -r "$CONFIG" ] ; then
+    DISPLAY=`sed -n "/DISPLAY/s/[^=]*=\(.*\)/\1/p" "$CONFIG"`
+    export DISPLAY
+
+    # only run when X is accessible
+    if "$XSET" -q >/dev/null 2>&1 ; then
+        "$PREFIX/bin/"$TBCMD
+    fi
+fi

http://wald.intevation.org/projects/trustbridge/