uninstall.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. export PATH=/bin:/usr/bin:/sbin:/usr/sbin
  3. ztpath="/Library/Application Support/ZeroTier/One"
  4. ztapp="/Applications/ZeroTier One.app"
  5. if [ "$UID" -ne 0 ]; then
  6. echo "Must be run as root; try: sudo $0"
  7. exit 1
  8. fi
  9. # Run with -q to be quieter and run without delay
  10. quickAndQuiet=0
  11. if [ "$1" = "-q" ]; then
  12. quickAndQuiet=1
  13. echo() { :; }
  14. fi
  15. echo
  16. if [ $quickAndQuiet -eq 0 ]; then
  17. echo "This will uninstall ZeroTier One, hit CTRL+C to abort."
  18. echo "Waiting 5 seconds..."
  19. sleep 5
  20. fi
  21. echo "Unloading and removing LaunchDaemons item..."
  22. launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist
  23. rm -f /Library/LaunchDaemons/com.zerotier.one.plist
  24. echo "Killing any running zerotier-one service..."
  25. killall -TERM zerotier-one >>/dev/null 2>&1
  26. sleep 3
  27. killall -KILL zerotier-one >>/dev/null 2>&1
  28. sleep 1
  29. echo "Unloading kernel extension..."
  30. kextunload "$ztpath/tap.kext" >>/dev/null 2>&1
  31. echo "Erasing UI app, binary, and support files..."
  32. cd "$ztpath"
  33. rm -rfv "$ztapp" zerotier-one *.persist authtoken.secret identity.public *.log *.pid *.kext *.sh networks.d updates.d shutdownIfUnreadable
  34. echo "Done."
  35. echo
  36. echo "Your ZeroTier One identity is still preserved in $ztpath"
  37. echo "as identity.secret and can be manually deleted if you wish. Save it if"
  38. echo "you wish to re-use the address of this node, as it cannot be regenerated."
  39. echo
  40. exit 0