mirror of
https://github.com/SqrtMinusOne/dotfiles.git
synced 2025-12-10 19:23:03 +03:00
20 lines
611 B
Bash
Executable file
20 lines
611 B
Bash
Executable file
#!/usr/bin/env bash
|
|
# [[file:../../Guix.org::*vpn-start][vpn-start:1]]
|
|
export DISPLAY=:0
|
|
CONN=$(nmcli -f NAME con show --active | grep -Ev "(.*docker.*|NAME|br-.*|veth.*|tun.*|vnet.*|virbr.*)" | sed 's/ *$//g')
|
|
|
|
if [ -z "$CONN" ]; then
|
|
echo "No connection!"
|
|
notify-send "VPN" "No connection for VPN to run"
|
|
exit
|
|
fi
|
|
|
|
if [[ "$CONN" != *"Wired"* ]]; then
|
|
echo "Connection: $CONN"
|
|
notify-send "VPN" "Initializing for connection: $CONN"
|
|
|
|
pkexec nmcli con modify "$CONN" ipv6.method ignore
|
|
nmcli connection up "$CONN"
|
|
fi
|
|
pkexec openvpn --config ~/.vpn/openvpn.ovpn
|
|
# vpn-start:1 ends here
|