changeset 767:406bf18ee633

Merged
author Sascha Wilde <wilde@intevation.de>
date Tue, 08 Jul 2014 11:36:22 +0200
parents 9f0ad4bab175 (diff) b39f369523fb (current diff)
children 3f290ea49d45
files packaging/tmp-createpackage.sh
diffstat 2 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/packaging/linux-installer.inc.in	Mon Jul 07 18:55:51 2014 +0200
+++ b/packaging/linux-installer.inc.in	Tue Jul 08 11:36:22 2014 +0200
@@ -199,15 +199,28 @@
 
 setup_cronjob()
 {
-  # FIXME: handle case of system wide installation.
   local tmpcrontab=`mktemp`
-  crontab -l | grep -vF "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh" \
-                    >"$tmpcrontab"
+
+  if [ $SYSINST -eq 1 -a "${SUDO_USER+X}" ] ; then
+      local crontabopt="-u $SUDO_USER"
+  else
+      local crontabopt=''
+  fi
+
   if [ "$1" != "deinstall" ] ; then
-      echo "$(( $RANDOM / 555 )) 12  * * * \"${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh\"" \
+      local trustbridge_tray_starter="${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
+  else
+    local trustbridge_tray_starter="${oldinstcfg[PREFIX]}/bin/trustbridge-tray-starter.sh"
+  fi
+
+  crontab $crontabopt -l | \
+      grep -vF "$trustbridge_tray_starter" \
+           >"$tmpcrontab"
+  if [ "$1" != "deinstall" ] ; then
+      echo "$(( $RANDOM / 555 )) 12  * * * \"$trustbridge_tray_starter\"" \
            >>"$tmpcrontab"
   fi
-  crontab "$tmpcrontab"
+  crontab $crontabopt "$tmpcrontab"
   rm "$tmpcrontab"
 }
 
@@ -341,8 +354,6 @@
 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 "Setting up cronjob ..."
 setup_cronjob
--- a/ui/trustbridge-tray-starter.sh	Mon Jul 07 18:55:51 2014 +0200
+++ b/ui/trustbridge-tray-starter.sh	Tue Jul 08 11:36:22 2014 +0200
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 PREFIX=""
-CFGDIR=""
+CFGDIR="${XDG_CONFIG_HOME:-$HOME/.config}/BSI"
 TBCMD="trustbridge --tray"
 XSET=/usr/bin/xset
 CONFIG="$CFGDIR/trustbridge-tray-starter.cfg"

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