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

svn:r4311
This commit is contained in:
Nick Mathewson 2005-06-05 14:44:27 +00:00
parent 9f24078452
commit a94d7256ea
2 changed files with 26 additions and 2 deletions

View File

@ -24,6 +24,18 @@ if [ "x$TORGROUP" != "x" ]; then
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 @@ case "$1" in
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

View File

@ -54,11 +54,23 @@ if [ "x$TORGROUP" != "x" ]; then
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
#