TorPreFlight 880 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. # TorPreFlight is invoked before the install begins
  3. TMPFILE=`mktemp /tmp/TorSavedMe.tgz.XXXXXXXXXXXXX`
  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
  10. if [ -f /Library/StartupItems/Privoxy/Privoxy.loc ]; then
  11. PRIVOXYPATH=`cat /Library/StartupItems/Privoxy/Privoxy.loc`
  12. else
  13. PRIVOXYPATH="/Library/Privoxy/"
  14. fi
  15. # Backup all of Tor, just in case
  16. if [ -d $TORPATH ]; then
  17. tar zcf ${TMPFILE} ${TORPATH}/var/lib/tor ${TORPATH}/torrc ${PRIVOXYPATH}/config ${PRIVOXYPATH}/user.action
  18. fi
  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
  24. fi
  25. # This is complete, we have a fresh system on which to install Tor