Mercurial > trustbridge
changeset 764:5b505acbb2d1
Handle system wide installation for crontab.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Fri, 04 Jul 2014 18:41:23 +0200 |
parents | 654a8ca9d5b4 |
children | 7c3a8a8d3e52 |
files | packaging/linux-installer.inc.in |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/packaging/linux-installer.inc.in Fri Jul 04 18:06:23 2014 +0200 +++ b/packaging/linux-installer.inc.in Fri Jul 04 18:41:23 2014 +0200 @@ -199,15 +199,19 @@ setup_cronjob() { - # FIXME: handle case of system wide installation. local tmpcrontab=`mktemp` - crontab -l | grep -vF "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh" \ - >"$tmpcrontab" + local crontabopt='' + if [ $SYSINST -eq 1 -a "${SUDO_USER+X}" ] ; then + crontabopt="-u $SUDO_USER" + fi + crontab $crontabopt -l | \ + grep -vF "${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh" \ + >"$tmpcrontab" if [ "$1" != "deinstall" ] ; then echo "$(( $RANDOM / 555 )) 12 * * * \"${instcfg[PREFIX]}/bin/trustbridge-tray-starter.sh\"" \ >>"$tmpcrontab" fi - crontab "$tmpcrontab" + crontab $crontabopt "$tmpcrontab" rm "$tmpcrontab" }