sxmo_networks.sh: support multiple VPNs
Configurations with multiple VPNs currently fail to show the networks dialog due to a failing sed invocation due to multiple lines in VPNDEVICE env var: $ nmcli con show --active NAME UUID TYPE DEVICE wired xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ethernet eth0 mullvad-nl5 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx wireguard mullvad-nl5 lo xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx loopback lo wg-forge xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx wireguard wg-forge This patch adds support for arbitrary numbers of VPNs by concatenating the VPN names with a '|' and running the latter through sed with support for extended regexp (needed for the '|' interpreted as an or). Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
This commit is contained in:

committed by
Peter John Hartman

parent
a63a678077
commit
a69fbb2222
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
VPNDEVICE="$(nmcli con show --active | grep -E 'wireguard|vpn' | awk '{ print $1 }')"
|
VPNDEVICE="$(nmcli con show --active | grep -E 'wireguard|vpn' | awk '{ print $1 }' | paste -s -d '|')"
|
||||||
|
|
||||||
nofail() {
|
nofail() {
|
||||||
"$@" || return 0
|
"$@" || return 0
|
||||||
@@ -33,7 +33,7 @@ connections() {
|
|||||||
sed "s/802-3-ethernet:/$icon_usb /" | \
|
sed "s/802-3-ethernet:/$icon_usb /" | \
|
||||||
sed "s/^:/$icon_dof /" |\
|
sed "s/^:/$icon_dof /" |\
|
||||||
sed "s/^cdc-wdm.*:/$icon_don /" |\
|
sed "s/^cdc-wdm.*:/$icon_don /" |\
|
||||||
sed "s/^$VPNDEVICE.*:/$icon_don /" |\
|
sed -E "s/^$VPNDEVICE.*:/$icon_don /" |\
|
||||||
sed "s/^wlan.*:/$icon_don /" |\
|
sed "s/^wlan.*:/$icon_don /" |\
|
||||||
sed "s/^wwan.*:/$icon_don /" |\
|
sed "s/^wwan.*:/$icon_don /" |\
|
||||||
sed "s/^eth.*:/$icon_don /" |\
|
sed "s/^eth.*:/$icon_don /" |\
|
||||||
|
Reference in New Issue
Block a user