~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 3

[PATCH sxmo-utils] sxmo_networks.sh: support multiple VPNs

Details
Message ID
<20230618202126.21798-1-dev@open-music-kontrollers.ch>
DKIM signature
missing
Download raw message
Patch: +2 -2
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).
---
 scripts/core/sxmo_networks.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/core/sxmo_networks.sh b/scripts/core/sxmo_networks.sh
index 02c7a72..7445f4e 100755
--- a/scripts/core/sxmo_networks.sh
+++ b/scripts/core/sxmo_networks.sh
@@ -10,7 +10,7 @@

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() {
	"$@" || return 0
@@ -33,7 +33,7 @@ connections() {
		sed "s/802-3-ethernet:/$icon_usb /" | \
		sed "s/^:/$icon_dof /" |\
		sed "s/^cdc-wdm.*:/$icon_don /" |\
		sed "s/^$VPNDEVICE.*:/$icon_don /" |\
		sed -E "s/^$VPNDEVICE.*:/$icon_don /" |\
		sed "s/^wlan.*:/$icon_don /" |\
		sed "s/^wwan.*:/$icon_don /" |\
		sed "s/^eth.*:/$icon_don /" |\
-- 
2.41.0

[sxmo-utils/patches/test.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CTG2186E948R.3A66YLQDJO5UI@cirno2>
In-Reply-To
<20230618202126.21798-1-dev@open-music-kontrollers.ch> (view parent)
DKIM signature
missing
Download raw message
sxmo-utils/patches/test.yml: SUCCESS in 46s

[sxmo_networks.sh: support multiple VPNs][0] from [Hanspeter Portner][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/41969
[1]: dev@open-music-kontrollers.ch

✓ #1009379 SUCCESS sxmo-utils/patches/test.yml https://builds.sr.ht/~mil/job/1009379
Details
Message ID
<ZOyPcj1aCGHSwyUl@durand.trilidun.org>
In-Reply-To
<20230618202126.21798-1-dev@open-music-kontrollers.ch> (view parent)
DKIM signature
missing
Download raw message
Applied, thank you!

On Sun, Jun 18, 2023 at 10:21:26PM +0200, Hanspeter Portner wrote:
>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).
>---
> scripts/core/sxmo_networks.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/scripts/core/sxmo_networks.sh b/scripts/core/sxmo_networks.sh
>index 02c7a72..7445f4e 100755
>--- a/scripts/core/sxmo_networks.sh
>+++ b/scripts/core/sxmo_networks.sh
>@@ -10,7 +10,7 @@
>
> 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() {
> 	"$@" || return 0
>@@ -33,7 +33,7 @@ connections() {
> 		sed "s/802-3-ethernet:/$icon_usb /" | \
> 		sed "s/^:/$icon_dof /" |\
> 		sed "s/^cdc-wdm.*:/$icon_don /" |\
>-		sed "s/^$VPNDEVICE.*:/$icon_don /" |\
>+		sed -E "s/^$VPNDEVICE.*:/$icon_don /" |\
> 		sed "s/^wlan.*:/$icon_don /" |\
> 		sed "s/^wwan.*:/$icon_don /" |\
> 		sed "s/^eth.*:/$icon_don /" |\
>-- 
>2.41.0
>

--
sic dicit magister P
https://phartman.sites.luc.edu/
GPG keyID 0xE0DBD3D6 (CAE6 3A6F 755F 7BC3 36CA  330D B3E6 39C6 E0DB D3D6)
Reply to thread Export thread (mbox)