diff options
Diffstat (limited to '.old/wgconnect')
-rwxr-xr-x | .old/wgconnect | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/.old/wgconnect b/.old/wgconnect deleted file mode 100755 index de8f307..0000000 --- a/.old/wgconnect +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# Connect to/disconnect from wireguard tunnel using dmenu - -sudo="${SUDO:-sudo}" -pass="$(xsudo --get-pass)" - -ssudo() { echo "$pass" | $sudo $@ ; } - -dmenu_confirm_continue() { - case "$(echo "yes\nno" | dmenu -p "$1")" in - yes) - ;; - *) exit 0 ;; - esac -} - -curtun="$(ssudo wg show | sed 's/interface: //;q')" - -# Ask to disconnect from current interface -if [ -n "$curtun" ]; then - dmenu_confirm_continue "Currently connected to tunnel $curtun. Disconnect?" - - output="$(ssudo wg-quick down "$curtun" 2>&1)" - notify-send "Disconnected from $curtun" "$output" - - dmenu_confirm_continue "Connect to another interface?" -fi - -# Connect to new interface -tundir=/etc/wireguard - -tun="$tundir/$(ssudo ls "$tundir" | grep "\.conf$" | dmenu -p "Connect to which tunnel?")" - -if ! ssudo cat $tun >/dev/null 2>/dev/null; then - notify-send "Couldn't connect to tunnel $tun" - exit 1 -fi - -output="$(ssudo wg-quick up "$tun" 2>&1)" -notify-send "Connected to $tun" "$output" |