mirror of https://github.com/oxen-io/lokinet
update packaging for macos add preinstall script that nukes any existing lokinet make uninstaller revert dns to "empty" make cpack use preinstall script in pkg file
parent
384b968cf0
commit
0afe9f0138
@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# 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
|
||||
# suspend existing lokinet if it's there
|
||||
[ -e /var/lib/lokinet ] && touch /var/lib/lokinet/suspend-launchd-service
|
||||
# kill it
|
||||
killall lokinet || true
|
||||
# wait a sec
|
||||
sleep 1
|
||||
# make sure it's fucking dead
|
||||
killall -9 lokinet || true
|
||||
|
||||
# check for prexisting lokinet and kill it if it's there
|
||||
[ -e /Library/LaunchDaemons/network.loki.lokinet.daemon.plist ] && (
|
||||
launchctl stop network.loki.lokinet.daemon ;
|
||||
launchctl unload /Library/LaunchDaemons/network.loki.lokinet.daemon.plist ;
|
||||
rm -rf /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
|
||||
)
|
||||
|
||||
# clear out the install dir beforehand
|
||||
rm -rf /opt/lokinet
|
Loading…
Reference in New Issue