Tor_Uninstaller.applescript 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. -- Tor Uninstaller.applescript
  2. -- Tor Uninstaller
  3. -- ===============================================================================
  4. -- Tor Uninstaller is distributed under this license:
  5. --
  6. -- Copyright (c) 2005 Andrew Lewman ( pgp key: 31B0974B )
  7. --
  8. -- Redistribution and use in source and binary forms, with or without
  9. -- modification, are permitted provided that the following conditions are
  10. -- met:
  11. --
  12. -- * Redistributions of source code must retain the above copyright
  13. -- notice, this list of conditions and the following disclaimer.
  14. --
  15. -- * Redistributions in binary form must reproduce the above
  16. -- copyright notice, this list of conditions and the following disclaimer
  17. -- in the documentation and/or other materials provided with the
  18. -- distribution.
  19. --
  20. -- * Neither the names of the copyright owners nor the names of its
  21. -- contributors may be used to endorse or promote products derived from
  22. -- this software without specific prior written permission.
  23. --
  24. -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. -- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. -- ===============================================================================
  36. -- Validate & find disk paths
  37. set boot_disk to (path to startup disk) as string
  38. set default_tor_path to boot_disk & "Library:Tor"
  39. set default_privoxy_path to boot_disk & "Library:Privoxy"
  40. set default_tor_startup_path to boot_disk & "Library:StartupItems:Tor"
  41. set default_privoxy_startup_path to boot_disk & "Library:StartupItems:Privoxy"
  42. set shell_script to default_tor_path & ":uninstall_tor_bundle.sh"
  43. set doomed_path_list to {default_tor_path, default_privoxy_path, default_tor_startup_path, default_privoxy_startup_path}
  44. -- Display what we're removing and ask for validation
  45. -- this is the simplest way to do this
  46. set remove_me to display dialog "Welcome to the Tor + Privoxy Uninstaller. This program will remove:" & return & default_tor_path & return & default_privoxy_path & return & default_tor_startup_path & return & default_privoxy_startup_path & return & return & "If this does not look right, choose Yes. Otherwise, choose No." buttons {"Yes", "No"} default button "No"
  47. -- Run a shell script to do all the unix work since applescript can't see it at all
  48. if button returned of result is "Yes" then
  49. try
  50. do shell script (shell_script) with administrator privileges
  51. on error
  52. display dialog "Too many errors, quitting." buttons {"Quit"} default button "Quit" with icon stop giving up after 5
  53. quit
  54. end try
  55. -- So Long and Thanks for all the Fish!
  56. display dialog "Thank you for using tor!" buttons {"Ok"} giving up after 5
  57. else
  58. display dialog "Thank you for your continued use of Tor & Privoxy" buttons {"You're welcome."}
  59. end if
  60. -- We're done