aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/etc/uci-defaults
diff options
context:
space:
mode:
authorRafał Miłecki <rafal@milecki.pl>2021-05-15 23:04:35 +0200
committerRafał Miłecki <rafal@milecki.pl>2021-05-18 20:07:56 +0200
commitf716c30241d5fd9d821560f58d0af0c3ffe78600 (patch)
treeeea6ec5a2d38f45d5f20fd2d7c5c591aba503679 /package/base-files/files/etc/uci-defaults
parent43fc720657c6e3b30c6ed89d7227ee6e646c158b (diff)
downloadupstream-f716c30241d5fd9d821560f58d0af0c3ffe78600.tar.gz
upstream-f716c30241d5fd9d821560f58d0af0c3ffe78600.tar.bz2
upstream-f716c30241d5fd9d821560f58d0af0c3ffe78600.zip
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@milecki.pl>
Diffstat (limited to 'package/base-files/files/etc/uci-defaults')
-rw-r--r--package/base-files/files/etc/uci-defaults/11_network-migrate-bridges23
1 files changed, 23 insertions, 0 deletions
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