changeset 1243:cf5784d2c3a8

(issue54) Safeguard to prohibit starting the application as root
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 24 Sep 2014 19:22:47 +0200
parents e4aff35ef8fd
children 94685a66950a
files packaging/linux-installer.inc
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/packaging/linux-installer.inc	Wed Sep 24 17:55:14 2014 +0200
+++ b/packaging/linux-installer.inc	Wed Sep 24 19:22:47 2014 +0200
@@ -137,13 +137,15 @@
   echo "  $UN_RUNCMD ${instcfg[PREFIX]}/bin/trustbridge-uninstall.sh"
 
   echo "################################################################################"
-  getxt "Press enter to launch '%s'\n" "${instcfg[PREFIX]}/bin/trustbridge"
-  getxt "or press Control-C to quit the installer.\n"
-  if [ $UPDATE -eq 0 ]; then
-    read
-    $RUNCMD "${instcfg[PREFIX]}/bin/trustbridge" &
-  else
-    $RUNCMD "${instcfg[PREFIX]}/bin/trustbridge" --tray &
+  if ! [ $(id -u) -eq 0 -a -z "$SUDO_USER" ]; then
+    if [ $UPDATE -eq 0 ]; then
+      getxt "Press enter to launch '%s'\n" "${instcfg[PREFIX]}/bin/trustbridge"
+      getxt "or press Control-C to quit the installer.\n"
+      read
+      $RUNCMD "${instcfg[PREFIX]}/bin/trustbridge" &
+    else
+      $RUNCMD "${instcfg[PREFIX]}/bin/trustbridge" --tray &
+    fi
   fi
 }
 

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