From 1478636f549d0791da78ef1cdd93cc5a44c3e8c2 Mon Sep 17 00:00:00 2001 From: Andrew Lewman Date: Sun, 16 Jul 2006 13:58:10 +0000 Subject: Change the way Tor starts on OSX 10.4 vs pre-10.4. 10.4 Tor now uses launchd for current and forward compatibility. svn:r6766 --- contrib/osx/TorPostflight | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'contrib/osx/TorPostflight') diff --git a/contrib/osx/TorPostflight b/contrib/osx/TorPostflight index cf40cdda46..5713fd82b5 100644 --- a/contrib/osx/TorPostflight +++ b/contrib/osx/TorPostflight @@ -19,6 +19,25 @@ if [ "$TARGET" == "//Library/Tor" ]; then TARGET=/Library/Tor fi +## Determine OSX Version +# map version to name +if [ -x /usr/bin/sw_vers ]; then +# This is poor, yet functional. We don't care about the 3rd number in +# the OS version + OSVER=`/usr/bin/sw_vers | grep ProductVersion | cut -f2 | cut -d"." -f1,2` + case "$OSVER" in + "10.5") OS="leopard";; + "10.4") OS="tiger";; + "10.3") OS="panther";; + "10.2") OS="jaguar";; + "10.1") OS="puma";; + "10.0") OS="cheetah";; + *) OS="unknown";; + esac +else + OS="unknown" +fi + # Create user $TORUSER in group daemon. If it's already there, great. $ADDSYSUSER $TORUSER "Tor System user" $TORDIR @@ -88,6 +107,7 @@ if [ -f $PACKAGE_PATH/Contents/Resources/Tor_Uninstaller.app.tar.gz ]; then cd $TARGET && tar zxf Tor_Uninstaller.app.tar.gz chmod -R 755 $TARGET/Tor_Uninstaller.app chown -R _tor:_tor Tor_Uninstaller.app + rm $TARGET/Tor_Uninstaller.app.tar.gz fi if [ -f $PACKAGE_PATH/Contents/Resources/uninstall_tor_bundle.sh ]; then @@ -98,3 +118,14 @@ fi if [ -f $PACKAGE_PATH/Contents/Resources/package_list.txt ]; then cp $PACKAGE_PATH/Contents/Resources/package_list.txt $TARGET/package_list.txt fi + +if [ $OS = "tiger" ]; then + if [ -f $PACKAGE_PATH/Contents/Resources/net.freehaven.tor.plist ]; then + cp $PACKAGE_PATH/Contents/Resources/net.freehaven.tor.plist /System/Library/LaunchDaemons/net.freehaven.tor.plist + fi +else + if [ -d /Library/StartupItems/Tor ]; then + rm -f /Library/StartupItems/Tor/Tor.loc + echo "$TARGET" > /Library/StartupItems/Tor/Tor.loc + fi +fi -- cgit v1.2.3-54-g00ecf