The whole process works from preflight to postflight creating a clean
[tor/rransom.git] / contrib / osx / TorPreFlight
blob3a3187fc9e18379c68cc13aca12516caa98f2ac6
1 #!/bin/sh
2 # TorPreFlight is invoked before the install begins
4 # Figure out where Tor is installed
5 if [ -f /Library/StartupItems/Tor/Tor.loc ]; then
6 TORPATH=`cat /Library/StartupItems/Tor/Tor.loc`
7 elif [ -f /System/Library/LaunchDaemons/net.freehaven.tor.plist ]; then
8 TORPATH=/`grep -A1 "<key>Program</key>" /System/Library/LaunchDaemons/net.freehaven.tor.plist | grep string | cut -d"/" -f2,3`
9 else
10 TORPATH="/Library/Tor/"
12 echo $TORPATH
14 # Backup all of Tor, just in case
15 if [ -d $TORPATH ]; then
16 tar zcf /tmp/TorSavedMe.tar.gz $TORPATH/var/lib/tor $TORPATH/torrc
19 # Remove Tor and everything to do with it
20 if [ -f $TORPATH/uninstall_tor_bundle.sh ]; then
21 $TORPATH/uninstall_tor_bundle.sh
22 else
23 $PACKAGE_PATH/Contents/Resources/uninstall_tor_bundle.sh
26 # This is complete, we have a fresh system on which to install Tor