From d9070eb41a9bcefc76f6b902befc03436115cd34 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Fri, 12 Aug 2022 05:09:42 +0200 Subject: [PATCH] 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 --- .../upgrade/190-preserve-wireless-channels | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 package/gluon-core/luasrc/lib/gluon/upgrade/190-preserve-wireless-channels 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')