ZeroTierOne/ext/installfiles/mac/uninstall.sh

49 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
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
2015-05-26 21:36:04 +00:00
if [ ! -f '/Library/LaunchDaemons/com.zerotier.one.plist' ]; then
echo 'ZeroTier One does not seem to be installed.'
exit 1
fi
cd /
echo 'Stopping any running ZeroTier One service...'
launchctl unload '/Library/LaunchDaemons/com.zerotier.one.plist' >>/dev/null 2>&1
sleep 1
2013-11-13 14:07:59 +00:00
killall -TERM zerotier-one >>/dev/null 2>&1
sleep 1
2015-05-26 21:36:04 +00:00
killall -KILL zerotier-one >>/dev/null 2>&1
2013-11-13 14:07:59 +00:00
2015-05-26 21:36:04 +00:00
echo "Making sure kext is unloaded..."
kextunload '/Library/Application Support/ZeroTier/One/tap.kext' >>/dev/null 2>&1
2013-11-06 20:04:05 +00:00
2015-05-26 21:36:04 +00:00
echo "Removing ZeroTier One files..."
2014-01-10 06:58:31 +00:00
2015-05-26 21:36:04 +00:00
rm -rf '/Applications/ZeroTier One.app'
rm -f '/usr/bin/zerotier-one' '/usr/bin/zerotier-idtool' '/usr/bin/zerotier-cli' '/Library/LaunchDaemons/com.zerotier.one.plist'
mkdir -p /tmp/ZeroTierOne_uninstall_tmp
cp "/Library/Application Support/ZeroTier/One/*.secret" /tmp/ZeroTierOne_uninstall_tmp
rm -rf '/Library/Application Support/ZeroTier/One'
mkdir -p '/Library/Application Support/ZeroTier/One'
cp "/tmp/ZeroTierOne_uninstall_tmp/*.secret" '/Library/Application Support/ZeroTier/One'
chmod 0600 "/Library/Application Support/ZeroTier/One/*.secret"
rm -rf /tmp/ZeroTierOne_uninstall_tmp
2013-11-13 14:07:59 +00:00
2015-05-26 21:36:04 +00:00
echo 'Uninstall complete.'
2013-11-13 14:07:59 +00:00
echo
2015-05-26 21:36:04 +00:00
echo 'Your identity and secret authentication token have been preserved in:'
echo ' /Library/Application Support/ZeroTier/One'
echo
echo 'You can delete this folder and its contents if you do not intend to re-use'
echo 'them.'
2013-11-13 14:07:59 +00:00
echo
2013-11-06 20:04:05 +00:00
2013-11-13 14:07:59 +00:00
exit 0