25 lines
516 B
Bash
Executable File
25 lines
516 B
Bash
Executable File
#!/bin/bash -e
|
|
|
|
function off() {
|
|
local ifs
|
|
|
|
read -ra ifs < <(wg show interfaces) || true
|
|
for i in "${ifs[@]}"; do
|
|
wg-quick down "$i"
|
|
done
|
|
}
|
|
|
|
[ "$EUID" != 0 ] && { pkexec bash -c "DISPLAY='$DISPLAY' XAUTHORITY='$XAUTHORITY' $0 $*"; exit; }
|
|
|
|
[ "$1" == off ] && { off; exit; }
|
|
|
|
if [ -n "$DISPLAY" ]; then
|
|
if="$(basename -s.conf /etc/wireguard/*.conf | /usr/local/bin/dmenu)"
|
|
else
|
|
select if in $(basename -s.conf /etc/wireguard/*.conf); do
|
|
break
|
|
done
|
|
fi
|
|
off
|
|
wg-quick up "$if"
|