From 6230b8b91844186ab1b3efba3f8f0b0260c2f4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=81nis=20Jansons?= Date: Tue, 22 Aug 2023 13:03:29 +0300 Subject: [PATCH] Cleanup --- swiftbar-vpn-plugin.sh | 44 ------------------------------------------ 1 file changed, 44 deletions(-) delete mode 100755 swiftbar-vpn-plugin.sh diff --git a/swiftbar-vpn-plugin.sh b/swiftbar-vpn-plugin.sh deleted file mode 100755 index 0910e2a..0000000 --- a/swiftbar-vpn-plugin.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# Get current status of a VPN connection with options to connect/disconnect. -# Working with OpenConnect, but can work with any executable VPN. Commands -# that require admin permissions should be whitelisted with 'visudo', e.g.: -# -#joesmith ALL=(ALL) NOPASSWD: /path/to/always-on-openconnect-vpn/run-vpn.sh -#joesmith ALL=(ALL) NOPASSWD: /usr/bin/killall -2 openconnect - -# VPN Status -# v1.0 -# Jesse Jarzynka -# jessejoe -# Displays status of a VPN interface with option to connect/disconnect. -# http://i.imgur.com/RkmptwO.png - -VPN_CONNECTED="ifconfig | egrep -A1 utun3 | grep inet" - -case "$1" in - connect) - terminal-notifier -title "VPN" -message "Connecting..." -sender "SwiftBar" - cd /path/to/always-on-openconnect-vpn/ - sudo /path/to/always-on-openconnect-vpn/run-vpn.sh &> /tmp/vpn.log & - until eval "$VPN_CONNECTED"; do sleep 1; done - terminal-notifier -title "VPN" -message "Connected!" -sender "SwiftBar" - ;; - disconnect) - eval "sudo killall -2 openconnect" - until [ -z "$(eval "$VPN_CONNECTED")" ]; do sleep 1; done - terminal-notifier -title "VPN" -message "Disconnected" -sender "SwiftBar" - ;; -esac - -if [ -n "$(eval "$VPN_CONNECTED")" ]; then - echo "VPN ✔" - echo '---' - echo "Disconnect VPN | bash='$0' param1=disconnect terminal=false refresh=true" - exit -else - echo "VPN ✘" - echo '---' - echo "Connect VPN | bash='$0' param1=connect terminal=false refresh=true" - exit -fi