Merge pull request #2613 from blocktrron/fix-preserve-channel

gluon-core: provide migration for preserve_channels
This commit is contained in:
David Bauer 2022-08-15 20:55:41 +02:00 committed by GitHub
commit fa04b8d4c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View File

@ -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.

View 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')

View File

@ -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()