[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] backport: [bug 144] Have torctl.in/tor.sh.in check for loca...



Update of /home/or/cvsroot/tor/contrib
In directory moria:/tmp/cvs-serv11643/contrib

Modified Files:
      Tag: tor-0_1_0-patches
	tor.sh.in torctl.in 
Log Message:
backport: [bug 144] Have torctl.in/tor.sh.in check for location of su binary.

Index: tor.sh.in
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/tor.sh.in,v
retrieving revision 1.8
retrieving revision 1.8.4.1
diff -u -d -r1.8 -r1.8.4.1
--- tor.sh.in	19 Nov 2004 08:36:25 -0000	1.8
+++ tor.sh.in	5 Jun 2005 14:44:43 -0000	1.8.4.1
@@ -24,6 +24,18 @@
 fi
 RETVAL=0
 
+if [ -x /bin/su ] ; then
+    SUPROG=/bin/su
+elif [ -x /sbin/su ] ; then
+    SUPROG=/sbin/su
+elif [ -x /usr/bin/su ] ; then
+    SUPROG=/usr/bin/su
+elif [ -x /usr/sbin/su ] ; then
+    SUPROG=/usr/sbin/su
+else
+    SUPROG=/bin/su
+fi
+
 case "$1" in
 
     start)
@@ -36,7 +48,7 @@
         if  [ "x$TORUSER" = "x" ]; then
             $TORBIN -f $TORCONF $TORARGS
         else
-            /bin/su -c "$TORBIN -f $TORCONF $TORARGS" $TORUSER
+            $SUPROG -c "$TORBIN -f $TORCONF $TORARGS" $TORUSER
         fi
         RETVAL=$?
         if [ $RETVAL -eq 0 ]; then

Index: torctl.in
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/torctl.in,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -u -d -r1.2 -r1.2.4.1
--- torctl.in	19 Nov 2004 08:36:25 -0000	1.2
+++ torctl.in	5 Jun 2005 14:44:43 -0000	1.2.4.1
@@ -54,11 +54,23 @@
     TORARGS="$TORARGS --group $TORGROUP"
 fi
 
+if [ -x /bin/su ] ; then
+    SUPROG=/bin/su
+elif [ -x /sbin/su ] ; then
+    SUPROG=/sbin/su
+elif [ -x /usr/bin/su ] ; then
+    SUPROG=/usr/bin/su
+elif [ -x /usr/sbin/su ] ; then
+    SUPROG=/usr/sbin/su
+else
+    SUPROG=/bin/su
+fi
+
 # the command used to start
 if  [ "x$TORUSER" = "x" ]; then
     START="$TORBIN -f $TORCONF $TORARGS"
 else
-    START="/bin/su -c \\"$TORBIN -f $TORCONF $TORARGS\\" $TORUSER"
+    START="$SUPROG -c \\"$TORBIN -f $TORCONF $TORARGS\\" $TORUSER"
 fi
 
 #