summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/tor.sh.in14
-rw-r--r--contrib/torctl.in14
2 files changed, 26 insertions, 2 deletions
diff --git a/contrib/tor.sh.in b/contrib/tor.sh.in
index b0a76314dd..2fc35b8410 100644
--- a/contrib/tor.sh.in
+++ b/contrib/tor.sh.in
@@ -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
diff --git a/contrib/torctl.in b/contrib/torctl.in
index ee865844ba..4faa8f0a0b 100644
--- a/contrib/torctl.in
+++ b/contrib/torctl.in
@@ -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
#