1
0
Fork 0

script changes

This commit is contained in:
Arthur Khachaturov 2024-08-18 03:41:19 +03:00
parent 6e8683c725
commit 775a43810c
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
6 changed files with 108 additions and 25 deletions

View file

@ -1,12 +1,6 @@
#!/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
@ -16,8 +10,6 @@ while [ "$#" -gt 0 ]; do
;;
'-v'|'--verbose') VERBOSE=1
;;
'--visual')
;;
*) echo "Wrong argument!"; exit 1
;;
esac
@ -35,15 +27,15 @@ UP_NAME="$(ip link show | grep 'wg' | cut -d ' ' -f 2 | sed 's/://')"
IFNAME="${IFNAME}${DPI}"
if [ -n "${UP_NAME}" ]; then
if [ "${UP_NAME}" != "${IFNAME}" ]; then
vpn_sock replace "${UP_NAME}" "${IFNAME}"
wg-quick down "${UP_NAME}"
wg-quick up "${IFNAME}"
else
vpn_sock down "${UP_NAME}"
wg-quick down "${UP_NAME}"
fi
else
vpn_sock up "${IFNAME}"
wg-quick up "${IFNAME}"
fi
read -r < "$PIPE"
pkill -36 dwmblocks
# vim: ft=bash