Skip to content
Snippets Groups Projects
Unverified Commit fa04b8d4 authored by David Bauer's avatar David Bauer Committed by GitHub
Browse files

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

gluon-core: provide migration for preserve_channels
parents 357aa96c bffd2636
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ During upgrades the wifi channel of the 2.4GHz and 5GHz radio will be restored t ...@@ -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.
......
#!/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) ...@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment