gluon/package/gluon-simple-tc/files/lib/gluon/upgrade/300-simple-tc-site-defaults
Matthias Schiffer 9b172bbaf4 Move all upgrade scripts to a common directory
Moving the scripts to a common directory not only vastly simplifies the
zzz-gluon-upgrade script, but also allows to define an ordering of such
scripts across packages.
2015-01-24 11:27:47 +01:00

24 lines
494 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site_config'
local uci = require 'luci.model.uci'
local c = uci.cursor()
for name, config in pairs(site.simple_tc) do
if not c:get('gluon-simple-tc', name) then
c:section('gluon-simple-tc', 'interface', name,
{
ifname = config.ifname,
enabled = config.enabled and 1 or 0,
limit_egress = config.limit_egress,
limit_ingress = config.limit_ingress,
}
)
end
end
c:save('gluon-simple-tc')
c:commit('gluon-simple-tc')