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
This commit is contained in:
Andrew Lewman 2006-07-16 13:58:10 +00:00
parent 886b10bbe2
commit 1478636f54
6 changed files with 55 additions and 12 deletions

View File

@ -5,3 +5,4 @@ TorBundleInfo.plist
TorDesc.plist TorDesc.plist
TorInfo.plist TorInfo.plist
TorStartupDesc.plist TorStartupDesc.plist
net.freehaven.tor.plist

View File

@ -6,4 +6,5 @@ EXTRA_DIST = PrivoxyConfDesc.plist PrivoxyConfInfo.plist \
TorInfo.plist.in TorStartupDesc.plist.in TorStartupInfo.plist \ TorInfo.plist.in TorStartupDesc.plist.in TorStartupInfo.plist \
package.sh privoxy.config TorPostflight addsysuser \ package.sh privoxy.config TorPostflight addsysuser \
Tor_Uninstaller.applescript uninstall_tor_bundle.sh \ 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

View File

@ -19,6 +19,25 @@ if [ "$TARGET" == "//Library/Tor" ]; then
TARGET=/Library/Tor TARGET=/Library/Tor
fi 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. # Create user $TORUSER in group daemon. If it's already there, great.
$ADDSYSUSER $TORUSER "Tor System user" $TORDIR $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 cd $TARGET && tar zxf Tor_Uninstaller.app.tar.gz
chmod -R 755 $TARGET/Tor_Uninstaller.app chmod -R 755 $TARGET/Tor_Uninstaller.app
chown -R _tor:_tor Tor_Uninstaller.app chown -R _tor:_tor Tor_Uninstaller.app
rm $TARGET/Tor_Uninstaller.app.tar.gz
fi fi
if [ -f $PACKAGE_PATH/Contents/Resources/uninstall_tor_bundle.sh ]; then 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 if [ -f $PACKAGE_PATH/Contents/Resources/package_list.txt ]; then
cp $PACKAGE_PATH/Contents/Resources/package_list.txt $TARGET/package_list.txt cp $PACKAGE_PATH/Contents/Resources/package_list.txt $TARGET/package_list.txt
fi 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

View File

@ -31,7 +31,6 @@
<key>LowPriorityIO</key> <key>LowPriorityIO</key>
<true/> <true/>
<!--
<key>HardResourceLimits</key> <key>HardResourceLimits</key>
<dict> <dict>
<key>Core</key> <key>Core</key>
@ -61,7 +60,7 @@
<key>Stack</key> <key>Stack</key>
<integer>10000000000</integer> <integer>10000000000</integer>
</dict> </dict>
-->
<key>Bonjour</key> <key>Bonjour</key>
<false/> <false/>

View File

@ -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/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/package_list.txt $BUILD_DIR/tor_resources/package_list.txt
cp contrib/osx/tor_logo.gif $BUILD_DIR/tor_resources/background.gif 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 cat <<EOF > $BUILD_DIR/tor_resources/Welcome.txt
Tor: an anonymous Internet communication system Tor: an anonymous Internet communication system
@ -130,17 +133,22 @@ $PACKAGEMAKER -build \
-d contrib/osx/PrivoxyConfDesc.plist -d contrib/osx/PrivoxyConfDesc.plist
### Make Startup Script package ### Make Startup Script package
# If Tiger or later, use launchd. Otherwise, use StartupItems
mkdir -p $BUILD_DIR/torstartup_packageroot/Library/StartupItems/Tor if [ $OS = "tiger" ]; then
cp contrib/osx/Tor contrib/osx/StartupParameters.plist \ 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 $BUILD_DIR/torstartup_packageroot/Library/StartupItems/Tor
find $BUILD_DIR/torstartup_packageroot -print0 | sudo xargs -0 chown root:wheel find $BUILD_DIR/torstartup_packageroot -print0 | sudo xargs -0 chown root:wheel
$PACKAGEMAKER -build \ $PACKAGEMAKER -build \
-p $BUILD_DIR/output/torstartup.pkg \ -p $BUILD_DIR/output/torstartup.pkg \
-f $BUILD_DIR/torstartup_packageroot \ -f $BUILD_DIR/torstartup_packageroot \
-i contrib/osx/TorStartupInfo.plist \ -i contrib/osx/TorStartupInfo.plist \
-d contrib/osx/TorStartupDesc.plist -d contrib/osx/TorStartupDesc.plist
fi
### Assemble the metapackage. Packagemaker won't buld metapackages from ### Assemble the metapackage. Packagemaker won't buld metapackages from
# the command line, so we need to do it by hand. # the command line, so we need to do it by hand.

View File

@ -134,7 +134,10 @@ niutil -destroy . /users/$TOR_USER
## clean up ## clean up
echo ". Cleaning up" echo ". Cleaning up"
rm -rf $TEMP_BOM_CONTENTS 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" echo ". Finished"