summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lewman <andrew@torproject.org>2006-07-27 17:19:32 +0000
committerAndrew Lewman <andrew@torproject.org>2006-07-27 17:19:32 +0000
commit37706854985095c41f962c03ed1addd25494b38b (patch)
tree3287549cb75ce7b5c2eafa634a0515a43680fad1
parentdc2b7e9af08aeb7c45bc45ad9ddc1fd2f8ebb6e8 (diff)
downloadtor-37706854985095c41f962c03ed1addd25494b38b.tar.gz
tor-37706854985095c41f962c03ed1addd25494b38b.zip
Far better test and handling of existing torrc
svn:r6923
-rw-r--r--contrib/osx/TorPostflight21
1 files changed, 11 insertions, 10 deletions
diff --git a/contrib/osx/TorPostflight b/contrib/osx/TorPostflight
index 8cda3978f3..898a172af0 100644
--- a/contrib/osx/TorPostflight
+++ b/contrib/osx/TorPostflight
@@ -122,20 +122,21 @@ if [ -f /tmp/TorSavedMe.tar.gz ]; then
fi
# Determine how to start by OS Version
-if [ $OS = "tiger" ]; then
+if [ $OS = "tiger" || $OS = "leopard" ]; then
if [ -f $PACKAGE_PATH/Contents/Resources/net.freehaven.tor.plist ]; then
rm -rf /Library/StartupItems/Tor
cp $PACKAGE_PATH/Contents/Resources/net.freehaven.tor.plist /System/Library/LaunchDaemons/net.freehaven.tor.plist
chmod 644 /System/Library/LaunchDaemons/net.freehaven.tor.plist
- echo "#--START required settings--" >> $TARGET/torrc
- echo "RunAsDaemon 0" >> $TARGET/torrc
- echo "Log notice file $TARGET/var/log/tor/tor.log" >> $TARGET/torrc
- echo "DataDirectory $TARGET/var/lib/tor" >> $TARGET/torrc
- echo "Group daemon" >> $TARGET/torrc
- echo "User _tor" >> $TARGET/torrc
- echo "PidFile /var/run/Tor.pid" >> $TARGET/torrc
- echo "#--END required settings--" >> $TARGET/torrc
- fi
+ if [ -f $TARGET/torrc ]; then
+ IFS=,
+ CONFIGVARS="#--START,RunAsDaemon 0,Log notice file $TARGET/var/log/tor/tor.log,DataDirectory $TARGET/var/lib/tor,Group daemon,User _tor,PidFile /var/run/Tor.pid,#--END"
+ for var in ${CONFIGVARS}
+ do
+ RC=`grep ^$var $TARGET/torrc`
+ if [ -z $RC ]; then
+ echo "$var" >> $TARGET/torrc
+ fi
+ done
/bin/launchctl load /System/Library/LaunchDaemons/net.freehaven.tor.plist
/bin/launchctl start net.freehaven.tor
else