diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/190-preserve-wireless-channels b/package/gluon-core/luasrc/lib/gluon/upgrade/190-preserve-wireless-channels new file mode 100755 index 00000000..ee25c130 --- /dev/null +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/190-preserve-wireless-channels @@ -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')