Преглед изворни кода

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 <[email protected]>
Rafał Miłecki пре 4 година
родитељ
комит
f716c30241
1 измењених фајлова са 23 додато и 0 уклоњено
  1. 23 0
      package/base-files/files/etc/uci-defaults/11_network-migrate-bridges

+ 23 - 0
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