TorPreFlight 808 B

12345678910111213141516171819202122232425
  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. else if [ -f /System/Library/LaunchDaemons/net.freehaven.tor ]; 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. # Backup all of Tor, just in case
  12. if [ -d $TORPATH ]; then
  13. tar zcf ~/`date "+%Y-%m-%d"`-Tor.backup.tar.gz $TORPATH
  14. fi
  15. # Remove Tor and everything to do with it
  16. if [ -f $TORPATH/uninstall_tor_bundle.sh ]; then
  17. $TORPATH/uninstall_tor_bundle.sh
  18. else
  19. $PACKAGE_PATH/Contents/Resources/uninstall_tor_bundle.sh
  20. fi
  21. # This is complete, we have a fresh system on which to install Tor