aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorAndrew Lewman <andrew@torproject.org>2006-07-16 13:58:10 +0000
committerAndrew Lewman <andrew@torproject.org>2006-07-16 13:58:10 +0000
commit1478636f549d0791da78ef1cdd93cc5a44c3e8c2 (patch)
tree95a9aefc712341db476195e8efc381d82ed83b62 /contrib
parent886b10bbe2aa61fb325dec6aaae13f4804d86e2b (diff)
downloadtor-1478636f549d0791da78ef1cdd93cc5a44c3e8c2.tar
tor-1478636f549d0791da78ef1cdd93cc5a44c3e8c2.tar.gz
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
Diffstat (limited to 'contrib')
-rw-r--r--contrib/osx/.cvsignore1
-rw-r--r--contrib/osx/Makefile.am3
-rw-r--r--contrib/osx/TorPostflight31
-rw-r--r--contrib/osx/net.freehaven.tor.plist.in3
-rw-r--r--contrib/osx/package.sh24
-rwxr-xr-xcontrib/osx/uninstall_tor_bundle.sh5
6 files changed, 55 insertions, 12 deletions
diff --git a/contrib/osx/.cvsignore b/contrib/osx/.cvsignore
index 67f1031f4..7ddb73f5a 100644
--- a/contrib/osx/.cvsignore
+++ b/contrib/osx/.cvsignore
@@ -5,3 +5,4 @@ TorBundleInfo.plist
TorDesc.plist
TorInfo.plist
TorStartupDesc.plist
+net.freehaven.tor.plist
diff --git a/contrib/osx/Makefile.am b/contrib/osx/Makefile.am
index 86713dfc5..5e61bc3ee 100644
--- a/contrib/osx/Makefile.am
+++ b/contrib/osx/Makefile.am
@@ -6,4 +6,5 @@ EXTRA_DIST = PrivoxyConfDesc.plist PrivoxyConfInfo.plist \
TorInfo.plist.in TorStartupDesc.plist.in TorStartupInfo.plist \
package.sh privoxy.config TorPostflight addsysuser \
Tor_Uninstaller.applescript uninstall_tor_bundle.sh \
- package_list.txt tor_logo.gif Tor_Uninstaller.app.tar.gz
+ package_list.txt tor_logo.gif Tor_Uninstaller.app.tar.gz \
+ net.freehaven.tor.plist.in
diff --git a/contrib/osx/TorPostflight b/contrib/osx/TorPostflight
index cf40cdda4..5713fd82b 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
diff --git a/contrib/osx/net.freehaven.tor.plist.in b/contrib/osx/net.freehaven.tor.plist.in
index 98d59cd2e..bf31e1d3a 100644
--- a/contrib/osx/net.freehaven.tor.plist.in
+++ b/contrib/osx/net.freehaven.tor.plist.in
@@ -31,7 +31,6 @@
<key>LowPriorityIO</key>
<true/>
- <!--
<key>HardResourceLimits</key>
<dict>
<key>Core</key>
@@ -61,7 +60,7 @@
<key>Stack</key>
<integer>10000000000</integer>
</dict>
- -->
+
<key>Bonjour</key>
<false/>
diff --git a/contrib/osx/package.sh b/contrib/osx/package.sh
index 13ec2d081..20f1af5a8 100644
--- a/contrib/osx/package.sh
+++ b/contrib/osx/package.sh
@@ -82,6 +82,9 @@ cp contrib/osx/Tor_Uninstaller.app.tar.gz $BUILD_DIR/tor_resources/Tor_Uninstall
cp contrib/osx/uninstall_tor_bundle.sh $BUILD_DIR/tor_resources/uninstall_tor_bundle.sh
cp contrib/osx/package_list.txt $BUILD_DIR/tor_resources/package_list.txt
cp contrib/osx/tor_logo.gif $BUILD_DIR/tor_resources/background.gif
+if [ $OS = "tiger" OR $OS = "leopard" ]; then
+cp contrib/osx/net.freehaven.tor.plist $BUILD_DIR/tor_resources/net.freehaven.tor.plist
+fi
cat <<EOF > $BUILD_DIR/tor_resources/Welcome.txt
Tor: an anonymous Internet communication system
@@ -130,17 +133,22 @@ $PACKAGEMAKER -build \
-d contrib/osx/PrivoxyConfDesc.plist
### Make Startup Script package
+# If Tiger or later, use launchd. Otherwise, use StartupItems
-mkdir -p $BUILD_DIR/torstartup_packageroot/Library/StartupItems/Tor
-cp contrib/osx/Tor contrib/osx/StartupParameters.plist \
+if [ $OS = "tiger" ]; then
+ cp contrib/osx/net.freehaven.tor.plist $BUILD_DIR/tor_resources/net.freehaven.tor.plist
+else
+ mkdir -p $BUILD_DIR/torstartup_packageroot/Library/StartupItems/Tor
+ cp contrib/osx/Tor contrib/osx/StartupParameters.plist \
$BUILD_DIR/torstartup_packageroot/Library/StartupItems/Tor
-find $BUILD_DIR/torstartup_packageroot -print0 | sudo xargs -0 chown root:wheel
-$PACKAGEMAKER -build \
- -p $BUILD_DIR/output/torstartup.pkg \
- -f $BUILD_DIR/torstartup_packageroot \
- -i contrib/osx/TorStartupInfo.plist \
- -d contrib/osx/TorStartupDesc.plist
+ find $BUILD_DIR/torstartup_packageroot -print0 | sudo xargs -0 chown root:wheel
+ $PACKAGEMAKER -build \
+ -p $BUILD_DIR/output/torstartup.pkg \
+ -f $BUILD_DIR/torstartup_packageroot \
+ -i contrib/osx/TorStartupInfo.plist \
+ -d contrib/osx/TorStartupDesc.plist
+fi
### Assemble the metapackage. Packagemaker won't buld metapackages from
# the command line, so we need to do it by hand.
diff --git a/contrib/osx/uninstall_tor_bundle.sh b/contrib/osx/uninstall_tor_bundle.sh
index 9d69d09e5..eb70cf776 100755
--- a/contrib/osx/uninstall_tor_bundle.sh
+++ b/contrib/osx/uninstall_tor_bundle.sh
@@ -134,7 +134,10 @@ niutil -destroy . /users/$TOR_USER
## clean up
echo ". Cleaning up"
rm -rf $TEMP_BOM_CONTENTS
-rm -rf /Library/Privoxy/ /Library/StartupItems/Tor/ /Library/StartupItems/Privoxy/ /Library/Tor/
+rm -rf /Library/Privoxy/ /Library/StartupItems/Privoxy/ /Library/Tor/ /Library/StartupItems/Tor/
+if [ -f /System/Library/LaunchDaemons/net.freehaven.tor.plist ]; then
+ rm /System/Library/LaunchDaemons/net.freehaven.tor.plist
+fi
echo ". Finished"