TorPreFlight 836 B

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