[or-cvs] bug 144] Have torctl.in/tor.sh.in check for location of su ...

Nick Mathewson nickm at seul.org
Sun Jun 5 14:44:29 UTC 2005


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

Modified Files:
	tor.sh.in torctl.in 
Log Message:
[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.9
diff -u -d -r1.8 -r1.9
--- tor.sh.in	19 Nov 2004 08:36:25 -0000	1.8
+++ tor.sh.in	5 Jun 2005 14:44:27 -0000	1.9
@@ -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.3
diff -u -d -r1.2 -r1.3
--- torctl.in	19 Nov 2004 08:36:25 -0000	1.2
+++ torctl.in	5 Jun 2005 14:44:27 -0000	1.3
@@ -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
 
 #



More information about the tor-commits mailing list