2020-11-20 17:37:30 +00:00
|
|
|
#!/bin/sh
|
2020-11-18 22:06:48 +00:00
|
|
|
set -x
|
|
|
|
test `whoami` == root || exit 1
|
2020-04-21 03:28:27 +00:00
|
|
|
|
2020-11-13 15:18:51 +00:00
|
|
|
# this is for dns tomfoolery
|
|
|
|
scutil_query()
|
|
|
|
{
|
|
|
|
key=$1
|
|
|
|
|
|
|
|
scutil<<EOT
|
|
|
|
open
|
|
|
|
get $key
|
|
|
|
d.show
|
|
|
|
close
|
|
|
|
EOT
|
|
|
|
}
|
|
|
|
|
|
|
|
# get guid for service
|
|
|
|
SERVICE_GUID=`scutil_query State:/Network/Global/IPv4 \
|
|
|
|
| grep "PrimaryService" \
|
|
|
|
| awk '{print $3}'`
|
|
|
|
|
|
|
|
# get name of network service
|
|
|
|
SERVICE_NAME=`scutil_query Setup:/Network/Service/$SERVICE_GUID \
|
|
|
|
| grep "UserDefinedName" \
|
|
|
|
| awk -F': ' '{print $2}'`
|
|
|
|
|
|
|
|
# tell dns to be "empty" so that it's reset
|
|
|
|
networksetup -setdnsservers "$SERVICE_NAME" empty
|
|
|
|
|
|
|
|
# Prevent restarting on exit
|
2020-11-18 22:06:48 +00:00
|
|
|
touch /var/lib/lokinet/suspend-launchd-service
|
2020-11-20 17:37:30 +00:00
|
|
|
|
|
|
|
# shut off lokinet gracefully
|
|
|
|
pgrep lokinet$ && /opt/lokinet/bin/lokinet-vpn --kill
|
|
|
|
|
2020-11-18 22:06:48 +00:00
|
|
|
# kill the gui and such
|
|
|
|
killall LokinetGUI
|
|
|
|
killall lokinet
|
2020-11-13 15:18:51 +00:00
|
|
|
# if the launch daemon is there kill it
|
2020-11-18 22:06:48 +00:00
|
|
|
/bin/launchctl stop network.loki.lokinet.daemon
|
|
|
|
/bin/launchctl unload /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
|
|
|
|
|
|
|
|
# kill it and make sure it's dead
|
|
|
|
killall -9 lokinet
|
2020-04-21 03:28:27 +00:00
|
|
|
|
|
|
|
rm -rf /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
|
2020-11-16 21:07:58 +00:00
|
|
|
rm -rf /Applications/Lokinet/
|
2020-11-16 20:38:07 +00:00
|
|
|
rm -rf /Applications/LokinetGUI.app
|
2020-04-21 03:28:27 +00:00
|
|
|
rm -rf /var/lib/lokinet
|
|
|
|
rm -rf /usr/local/lokinet/
|
|
|
|
rm -rf /opt/lokinet
|
2020-11-18 22:06:48 +00:00
|
|
|
rm -f /etc/newsyslog.d/lokinet.conf
|