base-files: migrate old UCI network bridge ports syntax
[openwrt/openwrt.git] / package / base-files / files / etc / uci-defaults / 11_network-migrate-bridges
1 . /lib/functions.sh
2
3 migrate_ports() {
4 local config="$1"
5 local type ports ifname
6
7 config_get type "$config" type
8 [ "$type" != "bridge" ] && return
9
10 config_get ports "$config" ports
11 [ -n "$ports" ] && return
12
13 config_get ifname "$config" ifname
14 [ -z "$ifname" ] && return
15
16 for port in $ifname; do uci add_list network.$config.ports="$port"; done
17 uci delete network.$config.ifname
18 }
19
20 config_load network
21 config_foreach migrate_ports device
22
23 exit 1