summaryrefslogtreecommitdiff
path: root/ext/installfiles/mac/preinst.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ext/installfiles/mac/preinst.sh')
-rwxr-xr-xext/installfiles/mac/preinst.sh22
1 files changed, 17 insertions, 5 deletions
diff --git a/ext/installfiles/mac/preinst.sh b/ext/installfiles/mac/preinst.sh
index 9fa50bef..c2cb494b 100755
--- a/ext/installfiles/mac/preinst.sh
+++ b/ext/installfiles/mac/preinst.sh
@@ -4,11 +4,23 @@ export PATH=/bin:/usr/bin:/sbin:/usr/sbin
if [ -f /Library/LaunchDaemons/com.zerotier.one.plist ]; then
launchctl unload /Library/LaunchDaemons/com.zerotier.one.plist >>/dev/null 2>&1
- sleep 1
- killall zerotier-one
- sleep 1
- killall -9 zerotier-one
fi
-cd /Applications
+sleep 1
+
+if [ -d "/Library/Application Support/ZeroTier/One" ]; then
+ cd "/Library/Application Support/ZeroTier/One"
+ if [ -f "zerotier-one.pid" ]; then
+ ztpid=`cat zerotier-one.pid`
+ if [ "$ztpid" -gt "0" ]; then
+ kill `cat zerotier-one.pid`
+ fi
+ fi
+fi
+
+sleep 1
+
+cd "/Applications"
rm -rf "ZeroTier One.app"
+
+exit 0