Merge pull request #2613 from blocktrron/fix-preserve-channel
gluon-core: provide migration for preserve_channels
This commit is contained in:
commit
fa04b8d4c4
@ -19,7 +19,7 @@ During upgrades the wifi channel of the 2.4GHz and 5GHz radio will be restored t
|
|||||||
configured in the site.conf. If you need to preserve a user defined wifi channel during upgrades
|
configured in the site.conf. If you need to preserve a user defined wifi channel during upgrades
|
||||||
you can configure this via the uci section ``gluon-core.wireless``::
|
you can configure this via the uci section ``gluon-core.wireless``::
|
||||||
|
|
||||||
uci set gluon-core.@wireless[0].preserve_channels='1'
|
uci set gluon.wireless.preserve_channels='1'
|
||||||
|
|
||||||
When channels should be preserved, toggling the outdoor mode will have no effect on the channel settings.
|
When channels should be preserved, toggling the outdoor mode will have no effect on the channel settings.
|
||||||
Therefore, the Outdoor mode settings won't be displayed in config mode.
|
Therefore, the Outdoor mode settings won't be displayed in config mode.
|
||||||
|
23
package/gluon-core/luasrc/lib/gluon/upgrade/190-preserve-wireless-channels
Executable file
23
package/gluon-core/luasrc/lib/gluon/upgrade/190-preserve-wireless-channels
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/lua
|
||||||
|
|
||||||
|
local wireless = require 'gluon.wireless'
|
||||||
|
local uci = require('simple-uci').cursor()
|
||||||
|
|
||||||
|
local preserve_channels = wireless.preserve_channels(uci)
|
||||||
|
|
||||||
|
-- Migrate preserve channels from pre-2022.01
|
||||||
|
local core_wireless = uci:get_first('gluon-core', 'wireless')
|
||||||
|
if core_wireless ~= nil then
|
||||||
|
local preserve_legacy = uci:get_bool('gluon-core', core_wireless, 'preserve_channels')
|
||||||
|
if preserve_legacy then
|
||||||
|
preserve_channels = true
|
||||||
|
end
|
||||||
|
|
||||||
|
uci:delete('gluon-core', core_wireless)
|
||||||
|
uci:save('gluon-core')
|
||||||
|
end
|
||||||
|
|
||||||
|
uci:section('gluon', 'wireless', 'wireless', {
|
||||||
|
preserve_channels = preserve_channels or false,
|
||||||
|
})
|
||||||
|
uci:save('gluon')
|
@ -123,7 +123,7 @@ function M.foreach_radio(uci, f)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.preserve_channels(uci)
|
function M.preserve_channels(uci)
|
||||||
return uci:get('gluon', 'wireless', 'preserve_channels')
|
return uci:get_bool('gluon', 'wireless', 'preserve_channels')
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.device_supports_wpa3()
|
function M.device_supports_wpa3()
|
||||||
|
Loading…
Reference in New Issue
Block a user