From a31a802e8574b7de4cfe32fa470f47618b700c83 Mon Sep 17 00:00:00 2001 From: lemoer Date: Fri, 16 Dec 2022 00:29:29 +0100 Subject: [PATCH] gluon-core: fix invalid role configurations during reconfigure --- .../luasrc/lib/gluon/upgrade/021-interface-roles | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles b/package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles index 5d27fb70..6e39219a 100755 --- a/package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles +++ b/package/gluon-core/luasrc/lib/gluon/upgrade/021-interface-roles @@ -63,4 +63,19 @@ for iface in pairs(interfaces) do end end +-- Fix invalid role configurations + +uci:foreach('gluon', 'interface', function(interface) + + local function has_role(role) + return util.contains(interface.role, role) + end + + if has_role('client') and (has_role('mesh') or has_role('uplink')) then + -- remove 'client' role + util.remove_from_set(interface.role, 'client') + uci:set('gluon', interface['.name'], 'role', interface.role) + end +end) + uci:save('gluon')