mapcontroller, mapagent: add uci-default script for migration from 7.3 to 7.5

This commit is contained in:
arbala 2025-10-17 15:30:05 +02:00
parent 12c617822f
commit bfb09c7275
3 changed files with 86 additions and 0 deletions

View file

@ -0,0 +1,53 @@
#!/bin/sh
. /lib/functions.sh
cfg=mapagent
config_load $cfg
if uci -q get $cfg.agent.partial_wifi_reload >/dev/null; then
uci -q set $cfg.agent.partial_wifi_reload='0'
fi
if uci -q get $cfg.agent.chan_ch_relay_mcast >/dev/null; then
uci -q set $cfg.agent.chan_ch_relay_mcast='0'
fi
rename_dpp_uri() {
local section="$1"
local type device ifname band
local ch_list=""
config_get type "$section" type
config_get device "$section" device
config_get ifname "$section" ifname
config_get band "$section" band
config_get chirp_interval "$section" chirp_interval
append_chan() {
local val="$1"
local chan_num="${val#*/}"
ch_list="$ch_list $chan_num"
}
config_list_foreach "$section" chan append_chan
new_section=$(uci add "$cfg" dpp_chirp)
[ -n "$type" ] && uci set "$cfg.$new_section.type=$type"
[ -n "$device" ] && uci set "$cfg.$new_section.device=$device"
[ -n "$ifname" ] && uci set "$cfg.$new_section.ifname=$ifname"
[ -n "$band" ] && uci set "$cfg.$new_section.band=$band"
if [ -n "$chirp_interval" ]; then
uci set "${cfg}.${new_section}.chirp_interval=$chirp_interval"
fi
for ch in $ch_list; do
uci add_list "$cfg.$new_section.channel=$ch"
done
uci delete "$cfg.$section"
}
uci -q delete "$cfg.@dpp_controller[0]"
config_foreach rename_dpp_uri dpp_uri
exit 0

View file

@ -0,0 +1,29 @@
#!/bin/sh
. /lib/functions.sh
cfg=mapcontroller
config_load $cfg
uci -q get $cfg.controller.debug >/dev/null 2>&1 && \
uci set $cfg.controller.debug='2'
allow_bgdfs=$(uci -q get $cfg.controller.allow_bgdfs || echo "0")
channel_plan_val=$(uci -q get $cfg.controller.channel_plan || echo "0")
uci -q delete $cfg.controller.allow_bgdfs
uci -q delete $cfg.controller.channel_plan
uci -q get $cfg.controller.stale_sta_timeout >/dev/null 2>&1 || \
uci set $cfg.controller.stale_sta_timeout='30d'
uci -q del_list $cfg.controller.plugin='zerotouch'
uci -q add_list $cfg.controller.plugin='zerotouch'
if ! uci show $cfg 2>/dev/null | grep -q "=channel_plan"; then
section=$(uci add $cfg channel_plan)
uci set $cfg.$section.preclear_dfs="$allow_bgdfs"
uci set $cfg.$section.acs="$channel_plan_val"
fi
exit 0

View file

@ -24,6 +24,10 @@ adapt_sta_steering() {
uci del_list $cfg.@sta_steering[0].plugins="rcpi"
uci add_list $cfg.@sta_steering[0].plugins="rcpi"
uci del_list $cfg.@sta_steering[0].plugins="rate"
uci add_list $cfg.@sta_steering[0].plugins="rate"
uci del_list $cfg.@sta_steering[0].plugins="bsteer"
uci add_list $cfg.@sta_steering[0].plugins="bsteer"
uci -q set $cfg.@sta_steering[0].plugins_enabled="1"
uci -q set $cfg.@sta_steering[0].plugins_policy="any"