Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #!/bin/bash
  2. set -e
  3. 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 } }') )
  4. CON_UUID=$(zenity --list --column="Name" --column="State" --column="ID" --text="Choose VPN connection" --print-column="3" "${VPN_CONNECTIONS[@]}")
  5. ACTION=up
  6. if [[ "$(nmcli -t -g connection.uuid con show --active uuid $CON_UUID)" == $CON_UUID ]]; then
  7. ACTION=down
  8. fi
  9.  
  10. nmcli con $ACTION uuid $CON_UUID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement