avoid messy crashes (bugfix by nick)
[tor.git] / contrib / osx / TorPreFlight
blobb147264861d9c093546f918eaff05f8bbbe1462e
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 else
8 TORPATH="/Library/Tor/"
9 fi
11 if [ -f /Library/StartupItems/Privoxy/Privoxy.loc ]; then
12 PRIVOXYPATH=`cat /Library/StartupItems/Privoxy/Privoxy.loc`
13 else
14 PRIVOXYPATH="/Library/Privoxy/"
17 # Backup all of Tor, just in case
18 if [ -d $TORPATH ]; then
19 tar zcf /tmp/TorSavedMe.tar.gz $TORPATH/var/lib/tor $TORPATH/torrc $PRIVOXYPATH/config $PRIVOXYPATH/user.action
22 # Remove Tor and everything to do with it
23 if [ -f $TORPATH/uninstall_tor_bundle.sh ]; then
24 $TORPATH/uninstall_tor_bundle.sh
25 else
26 $PACKAGE_PATH/Contents/Resources/uninstall_tor_bundle.sh
29 # This is complete, we have a fresh system on which to install Tor