Tor_Uninstaller.applescript 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. on run
  37. -- Validate & find disk paths
  38. set boot_disk to (path to startup disk) as string
  39. set default_tor_path to boot_disk & "Library:Tor"
  40. set default_privoxy_path to boot_disk & "Library:Privoxy"
  41. set default_tor_startup_path to boot_disk & "Library:StartupItems:Tor"
  42. set default_privoxy_startup_path to boot_disk & "Library:StartupItems:Privoxy"
  43. set shell_script to default_tor_path & ":uninstall_tor_bundle.sh"
  44. set doomed_path_list to {default_tor_path, default_privoxy_path, default_tor_startup_path, default_privoxy_startup_path}
  45. -- Display what we're removing and ask for validation
  46. -- this is the simplest way to do this
  47. set remove_me to display dialog "Welcome to the Tor + Privoxy Uninstaller. This program will remove:" & return & return & POSIX path of default_tor_path & return & POSIX path of default_privoxy_path & return & POSIX path of default_tor_startup_path & return & POSIX path of default_privoxy_startup_path & return & return & "If this looks correct, choose Yes. Otherwise, choose No." buttons {"Yes", "No"} default button "No"
  48. -- Run a shell script to do all the unix work since applescript can't see it at all
  49. if button returned of result is "Yes" then
  50. try
  51. do shell script (POSIX path of shell_script) with administrator privileges
  52. on error
  53. display dialog "Too many errors, quitting." buttons {"Quit"} default button "Quit" with icon stop giving up after 3
  54. quit
  55. end try
  56. -- So Long and Thanks for all the Fish!
  57. display dialog "Thank you for using tor!" buttons {"Ok"} giving up after 3
  58. else
  59. display dialog "Thank you for your continued use of Tor & Privoxy" buttons {"You're welcome."} giving up after 3
  60. end if
  61. end run
  62. -- We're done