[PATCH] (issue54) Safeguard to prohibit starting the application as root

Wald Commits scm-commit at wald.intevation.org
Wed Sep 24 19:23:18 CEST 2014


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1411579367 -7200
# Node ID cf5784d2c3a826cd32e80fae6bbf2a33799ad802
# Parent  e4aff35ef8fd43e58e4bbdf15f7d08a5bc5089df
(issue54) Safeguard to prohibit starting the application as root

diff -r e4aff35ef8fd -r cf5784d2c3a8 packaging/linux-installer.inc
--- 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
 }
 


More information about the Trustbridge-commits mailing list