[openwrt/openwrt] base-files: migrate old UCI network bridge ports syntax

LEDE Commits lede-commits at lists.infradead.org
Tue May 18 11:12:17 PDT 2021


rmilecki pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/f716c30241d5fd9d821560f58d0af0c3ffe78600

commit f716c30241d5fd9d821560f58d0af0c3ffe78600
Author: Rafał Miłecki <rafal at milecki.pl>
AuthorDate: Sat May 15 23:04:35 2021 +0200

    base-files: migrate old UCI network bridge ports syntax
    
    netifd has been recently patched to use more accurate "ports" option
    instead of "ifname". This is a simple translation between two UCI
    options.
    
    Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 .../etc/uci-defaults/11_network-migrate-bridges    | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges b/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges
new file mode 100644
index 0000000000..745648531f
--- /dev/null
+++ b/package/base-files/files/etc/uci-defaults/11_network-migrate-bridges
@@ -0,0 +1,23 @@
+. /lib/functions.sh
+
+migrate_ports() {
+	local config="$1"
+	local type ports ifname
+
+	config_get type "$config" type
+	[ "$type" != "bridge" ] && return
+
+	config_get ports "$config" ports
+	[ -n "$ports" ] && return
+
+	config_get ifname "$config" ifname
+	[ -z "$ifname" ] && return
+
+	for port in $ifname; do uci add_list network.$config.ports="$port"; done
+	uci delete network.$config.ifname
+}
+
+config_load network
+config_foreach migrate_ports device
+
+exit 1



More information about the lede-commits mailing list