ZeroTierOne/ext/installfiles/mac/uninstall.sh

51 lines
1.5 KiB
Bash
Raw Normal View History

2013-11-06 20:04:05 +00:00
#!/bin/bash
2013-11-13 14:07:59 +00:00
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
zthome="/Library/Application Support/ZeroTier/One"
2014-01-10 22:09:08 +00:00
ztapp="/Applications/ZeroTier One.app"
2014-01-10 06:58:31 +00:00
if [ -z "$ztapp" -o ! -d "$ztapp" ]; then
2014-01-10 22:09:08 +00:00
ztapp=`mdfind kMDItemCFBundleIdentifier == 'com.zerotier.ZeroTierOne' | grep -E '.*ZeroTier One[.]app$' | grep -v -F '/build-' | grep -v -F '/Volumes/ZeroTier' | sort | head -n 1`
2014-01-10 06:58:31 +00:00
fi
2013-11-06 20:04:05 +00:00
if [ "$UID" -ne 0 ]; then
2013-11-13 14:07:59 +00:00
echo "Must be run as root; try: sudo $0"
2013-11-06 20:04:05 +00:00
exit 1
fi
echo "Killing any running zerotier-one service..."
2013-11-13 14:07:59 +00:00
killall -TERM zerotier-one >>/dev/null 2>&1
sleep 3
killall -KILL zerotier-one >>/dev/null 2>&1
sleep 1
2013-11-13 14:07:59 +00:00
echo "Unloading kernel extension..."
2014-01-10 06:58:31 +00:00
kextunload "$zthome/pre10.8/tap.kext" >>/dev/null 2>&1
kextunload "$zthome/tap.kext" >>/dev/null 2>&1
echo "Erasing GUI app (if installed)..."
2014-01-10 22:09:08 +00:00
if [ ! -z "$ztapp" -a -d "$ztapp" -a -f "$ztapp/Contents/Info.plist" ]; then
2014-01-10 06:58:31 +00:00
rm -rf "$ztapp"
fi
2013-11-06 20:04:05 +00:00
echo "Erasing service and support files..."
2014-01-10 06:58:31 +00:00
rm -f /usr/bin/zerotier-cli
rm -f /usr/bin/zerotier-idtool
cd "$zthome"
2014-01-10 06:58:31 +00:00
rm -f zerotier-one *.persist identity.public *.log *.pid *.sh shutdownIfUnreadable
rm -rf pre10.8 tap.kext updates.d networks.d
echo "Removing LaunchDaemons item..."
rm -f /Library/LaunchDaemons/com.zerotier.one.plist
launchctl remove com.zerotier.one
2013-11-13 14:07:59 +00:00
echo "Done."
echo
echo "Your ZeroTier One identity is still in: $zthome"
2013-11-13 14:07:59 +00:00
echo "as identity.secret and can be manually deleted if you wish. Save it if"
echo "you wish to re-use the address of this node, as it cannot be regenerated."
echo
2013-11-06 20:04:05 +00:00
2013-11-13 14:07:59 +00:00
exit 0