TorPreFlight 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. #
  3. # ===================================================================
  4. #
  5. # TorPreFlight is distributed under this license:
  6. #
  7. # Copyright (c) 2006 Andrew Lewman
  8. # Copyright (c) 2008 The Tor Project, Inc.
  9. #
  10. # Redistribution and use in source and binary forms, with or without
  11. # modification, are permitted provided that the following conditions are
  12. # met:
  13. #
  14. # * Redistributions of source code must retain the above copyright
  15. # notice, this list of conditions and the following disclaimer.
  16. #
  17. # * Redistributions in binary form must reproduce the above
  18. # copyright notice, this list of conditions and the following disclaimer
  19. # in the documentation and/or other materials provided with the
  20. # distribution.
  21. #
  22. # * Neither the names of the copyright owners nor the names of its
  23. # contributors may be used to endorse or promote products derived from
  24. # this software without specific prior written permission.
  25. #
  26. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  27. # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  28. # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  29. # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  30. # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  31. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  32. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  33. # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  34. # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  35. # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  36. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  37. #===============================================================================
  38. # TorPreFlight is invoked before the install begins
  39. # Figure out where Tor is installed
  40. if [ -f /Library/StartupItems/Tor/Tor.loc ]; then
  41. TORPATH=`cat /Library/StartupItems/Tor/Tor.loc`
  42. else
  43. TORPATH="/Library/Tor/"
  44. fi
  45. # Backup all of Tor, just in case
  46. if [ -d $TORPATH ]; then
  47. cp $TORPATH/torrc $TORPATH/torrc.installer-saved
  48. fi