Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- set -e
- IFS=$'\n' VPN_CONNECTIONS=( $(nmcli -t -f NAME,TYPE,UUID,STATE con show | awk -F: 'BEGIN { FS = ":" } ; { if ($2=="vpn") { if (!length($4)) state="deactivated"; else state=$4; print $1"\n"state"\n"$3 } }') )
- CON_UUID=$(zenity --list --column="Name" --column="State" --column="ID" --text="Choose VPN connection" --print-column="3" "${VPN_CONNECTIONS[@]}")
- ACTION=up
- if [[ "$(nmcli -t -g connection.uuid con show --active uuid $CON_UUID)" == $CON_UUID ]]; then
- ACTION=down
- fi
- nmcli con $ACTION uuid $CON_UUID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement