confd: sort interfaces according to length and name

A list of interfaces: x10 x9 x8 x7 x6 x5 x4 x1 x2 x3 should be sorted in
order with x10 last.  Using the common 'sort -n' would generate: x1 x10
x2 ... so we use version sort.  This way we can ensure that the order of
bridge ports is natural and what end users expect.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-10-30 12:48:14 +01:00
committed by Tobias Waldekranz
parent 7fd7a2e430
commit 120e87ac99
+2 -2
View File
@@ -85,13 +85,13 @@ phys_ifaces=$(ip -d -j link show | jq -r '
select(.link_type == "ether") |
select(.group != "internal") |
select(has("parentbus")) |
.ifname')
.ifname' | sort -V)
ports=$(ip -d -j link show group port | jq -r '
.[] |
select(.link_type == "ether") |
select(.group != "internal") |
select(has("parentbus")) |
.ifname')
.ifname' | sort -V)
ifaces=""
for phy in $phys_ifaces; do
found=""