gluon-core: provide migration for preserve_channels
The preserve_channels configuration option was moved to the gluon UCI package without adding a proper migration. Signed-off-by: David Bauer <mail@david-bauer.net>
This commit is contained in:
parent
357aa96c91
commit
d9070eb41a
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')
|
Loading…
Reference in New Issue
Block a user