1
0
Fork 0

chore: updates here and there

This commit is contained in:
Arthur Khachaturov 2024-08-17 18:16:07 +03:00
parent ed190866f5
commit 05708570cb
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
14 changed files with 58 additions and 67 deletions

View file

@ -1,6 +1,12 @@
#!/bin/bash
IFNAME="wg_lva"
PIPE="/var/run/vpnd.sock"
vpn_sock() {
echo echoing "$@"
[ -p "$PIPE" ] && echo "$@" > $PIPE
}
while [ "$#" -gt 0 ]; do
case "$1" in
@ -10,7 +16,7 @@ while [ "$#" -gt 0 ]; do
;;
'-v'|'--verbose') VERBOSE=1
;;
'--visual') USE_TERMINAL=1
'--visual')
;;
*) echo "Wrong argument!"; exit 1
;;
@ -26,20 +32,18 @@ fi
UP_NAME="$(ip link show | grep 'wg' | cut -d ' ' -f 2 | sed 's/://')"
sudo_a() {
dmenu -p "$1" <&-
}
if [ -n "${USE_TERMINAL}" ]; then
LAUNCH_CMD=(sudo -A -p "Password:")
fi
# shellcheck disable=SC2068
if [ -z "${UP_NAME}" ]; then
IFNAME="${IFNAME}${DPI}"
${LAUNCH_CMD[@]} wg-quick up "${IFNAME}"
IFNAME="${IFNAME}${DPI}"
if [ -n "${UP_NAME}" ]; then
if [ "${UP_NAME}" != "${IFNAME}" ]; then
vpn_sock replace "${UP_NAME}" "${IFNAME}"
else
vpn_sock down "${UP_NAME}"
fi
else
${LAUNCH_CMD[@]} wg-quick down "${UP_NAME}"
vpn_sock up "${IFNAME}"
fi
read -r < "$PIPE"
pkill -36 dwmblocks
# vim: ft=bash