[PATCH] Added trustbridge-tray-starter script for use with cron job

Wald Commits scm-commit at wald.intevation.org
Fri Jul 4 12:33:36 CEST 2014


# HG changeset patch
# User Sascha Wilde <wilde at intevation.de>
# Date 1404469971 -7200
# Node ID ea8d13590cbd1fa87d46a43f29f4e75653d65a49
# Parent  a26aada5900fbecab1edd119a582005ea164f3fb
Added trustbridge-tray-starter script for use with cron job.
 TODO: trustbridge must safe $DISPLAY in $CFGDIR/trustbridge-tray-starter.cfg

diff -r a26aada5900f -r ea8d13590cbd packaging/linux-createpackage.sh.in
--- 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.
diff -r a26aada5900f -r ea8d13590cbd packaging/linux-installer.inc.in
--- 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
diff -r a26aada5900f -r ea8d13590cbd ui/CMakeLists.txt
--- 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()
diff -r a26aada5900f -r ea8d13590cbd ui/trustbridge-tray-starter.sh
--- /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


More information about the Trustbridge-commits mailing list