Skip to content

Instantly share code, notes, and snippets.

@opragel
Last active August 23, 2020 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save opragel/f303319d21d1e62a205f5f17868edc3d to your computer and use it in GitHub Desktop.
Save opragel/f303319d21d1e62a205f5f17868edc3d to your computer and use it in GitHub Desktop.
remove_pritunl_osx.sh
#!/bin/bash
# Disclaimer: it's your funeral
APP_PROCESS_NAME="Pritunl"
DAEMON_PATHS=( "/Library/LaunchAgents/com.pritunl.client.plist" \
"/Library/LaunchDaemons/com.pritunl.service.plist" \
"/Library/LaunchDaemons/net.sf.tuntaposx.tap.plist" \
"/Library/LaunchDaemons/net.sf.tuntaposx.tun.plist" )
KEXT_PATHS=( "/Library/Extensions/tap.kext" \
"/Library/Extensions/tun.kext" )
REMOVE_PATHS=( "/Applications/Pritunl.app" \
"/Library/Extensions/tap.kext" \
"/Library/Extensions/tun.kext" \
"/Library/LaunchAgents/com.pritunl.client.plist" \
"/Library/LaunchDaemons/com.pritunl.service.plist" \
"/usr/local/bin/pritunl-openvpn" \
"/usr/local/bin/pritunl-service" )
for daemonPath in "${DAEMON_PATHS[@]}"
do
if [ -e "$daemonPath" ]; then
launchctl unload "$daemonPath"
else
printf "Not found: %s\n" "$daemonPath"
fi
done
for kextPath in "${KEXT_PATHS[@]}"
do
if [ -e "$kextPath" ]; then
kextunload "$kextPath"
else
printf "Not found: %s\n" "$kextPath"
fi
done
if pgrep "$APP_PROCESS_NAME"; then
killall "$APP_PROCESS_NAME"
fi
for removePath in "${REMOVE_PATHS[@]}"
do
if [ -e "$removePath" ]; then
printf "Deleting: %s\n" "$removePath"
rm -rf "$removePath"
else
printf "Not found: %s\n" "$removePath"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment