[or-cvs] Change the way Tor starts on OSX 10.4 vs pre-10.4. 10.4 To...

phobos at seul.org phobos at seul.org
Sun Jul 16 13:58:12 UTC 2006


Update of /home/or/cvsroot/tor/contrib/osx
In directory moria:/tmp/cvs-serv15999

Modified Files:
	.cvsignore Makefile.am TorPostflight 
	net.freehaven.tor.plist.in package.sh uninstall_tor_bundle.sh 
Log Message:
Change the way Tor starts on OSX 10.4 vs pre-10.4.  10.4 Tor now uses
launchd for current and forward compatibility.  


Index: .cvsignore
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -d -r1.3 -r1.4
--- .cvsignore	7 Jun 2005 18:32:13 -0000	1.3
+++ .cvsignore	16 Jul 2006 13:58:10 -0000	1.4
@@ -5,3 +5,4 @@ TorBundleInfo.plist
 TorDesc.plist
 TorInfo.plist
 TorStartupDesc.plist
+net.freehaven.tor.plist

Index: Makefile.am
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -p -d -r1.11 -r1.12
--- Makefile.am	7 Jul 2006 00:55:12 -0000	1.11
+++ Makefile.am	16 Jul 2006 13:58:10 -0000	1.12
@@ -6,4 +6,5 @@ EXTRA_DIST = PrivoxyConfDesc.plist Privo
     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

Index: TorPostflight
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/TorPostflight,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -p -d -r1.15 -r1.16
--- TorPostflight	7 Jul 2006 00:55:12 -0000	1.15
+++ TorPostflight	16 Jul 2006 13:58:10 -0000	1.16
@@ -19,6 +19,25 @@ if [ "$TARGET" == "//Library/Tor" ]; the
 	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
    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

Index: net.freehaven.tor.plist.in
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/net.freehaven.tor.plist.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -d -r1.4 -r1.5
--- net.freehaven.tor.plist.in	12 Jul 2006 22:09:21 -0000	1.4
+++ net.freehaven.tor.plist.in	16 Jul 2006 13:58:10 -0000	1.5
@@ -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/>
 

Index: package.sh
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/package.sh,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -p -d -r1.26 -r1.27
--- package.sh	7 Jul 2006 00:55:12 -0000	1.26
+++ package.sh	16 Jul 2006 13:58:10 -0000	1.27
@@ -82,6 +82,9 @@ cp contrib/osx/Tor_Uninstaller.app.tar.g
 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.

Index: uninstall_tor_bundle.sh
===================================================================
RCS file: /home/or/cvsroot/tor/contrib/osx/uninstall_tor_bundle.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -p -d -r1.2 -r1.3
--- uninstall_tor_bundle.sh	11 Mar 2006 06:13:08 -0000	1.2
+++ uninstall_tor_bundle.sh	16 Jul 2006 13:58:10 -0000	1.3
@@ -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"
 



More information about the tor-commits mailing list