diff options
Diffstat (limited to 'contrib/osx/Tor')
-rwxr-xr-x | contrib/osx/Tor | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/contrib/osx/Tor b/contrib/osx/Tor index ba2b1418d..83bb2a6f5 100755 --- a/contrib/osx/Tor +++ b/contrib/osx/Tor @@ -1,11 +1,21 @@ #!/bin/sh -TORCONF=/Library/Tor/torrc -TORDIR=/Library/Tor/var/lib/tor +TORLOC=/Library/StartupItems/Tor/Tor.loc + +if [ -f $TORLOC ]; then + TORDIR=`cat /Library/StartupItems/Tor/Tor.loc` + if [ "x$TORDIR" = "x" -o ! -d $TORDIR -o ! -x $TORDIR/tor ]; then + TORDIR=/Library/Tor + fi +else + TORDIR=/Library/Tor +fi +TORCONF=$TORDIR/torrc +TORDATA=$TORDIR/var/lib/tor TORPID=/var/run/Tor.pid TORUSER=_tor TORGROUP=daemon -TORCMD=/Library/Tor/tor +TORCMD=$TORDIR/tor TORLOG=/var/log/tor/tor.log ## @@ -25,7 +35,7 @@ StartService () # Tentative # Making sure it is not running (I know it is not a best approarch) killall tor 2>/dev/null - $TORCMD -f $TORCONF --runasdaemon 1 --pidfile $TORPID --datadirectory $TORDIR --user $TORUSER --group $TORGROUP --log "notice file $TORLOG" & + $TORCMD -f "$TORCONF" --runasdaemon 1 --pidfile "$TORPID" --datadirectory "$TORDATA" --user "$TORUSER" --group "$TORGROUP" --log "notice file $TORLOG" & fi fi } |