summaryrefslogtreecommitdiff
path: root/ext/installfiles/mac/preinst.sh
blob: c2cb494b117dad28cc8ee5abcad4ee9b231c2d5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

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
fi

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