Skip to content
Snippets Groups Projects
Unverified Commit a671b508 authored by Matthias Schiffer's avatar Matthias Schiffer
Browse files

gluon-core: preserve explicitly marked network and system sections

A section can be marked as preseved by setting the gluon_preserve option
to 1. In addition the following conditions must hold:

- The preserved section must not already exist after OpenWrt's and
  Gluons setup scripts run. Modifying existing sections is currently
  unsupported.
- Preserved sections must be named, so it can be detected whether a
  section conflicts with a preexisting one.
parent 6dcee2e3
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/lua
local uci = require('simple-uci').cursor()
for _, config in ipairs({'system', 'network'}) do
uci:foreach(config .. '_gluon-old', nil, function(s)
if s.gluon_preserve ~= '1' then return end
-- Unnamed sections can't be preserved
if s['.anonymous'] then return end
-- We don't allow overwriting existing sections
if uci:get(config, s['.name']) then return end
uci:section(config, s['.type'], s['.name'], s)
end)
uci:save(config)
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment