mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-18 21:28:02 +00:00
base-files: migrate old UCI network bridge ports syntax
netifd supports more accurate "ports" option (instead of "ifname") for years now. Relevant changes were even backported to OpenWrt 21.02. Add uci-defaults script that translates config files using deprecated syntax. Identical commitf716c30241
ended up reverted back in 2021 by80be798d4a
due to breaking downgrades. With 19.07 support ended it should no longer be an issue. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
parent
368441254e
commit
c8e68dce61
@ -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
|
Loading…
Reference in New Issue
Block a user