gluon/package/gluon-legacy/files/lib/gluon/upgrade/290-legacy-simple-tc
Matthias Schiffer 4658afb2c6 gluon-core: commit all UCI configs at the end
Avoid commiting configs inbetween to decrease number of flash writes.

Fixes #714.
2016-04-02 18:56:45 +02:00

29 lines
599 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site_config'
local sysconfig = require 'gluon.sysconfig'
local uci = require('luci.model.uci').cursor()
if sysconfig.gluon_version == 'legacy' then
for _, config in ipairs(site.legacy.tc_configs) do
local s = uci:get_first(config, 'bandwidth')
if s then
old = uci:get_all(config, s)
uci:section('simple-tc', 'interface', 'mesh_vpn',
{
ifname = 'mesh-vpn',
enabled = old.enabled,
limit_ingress = old.downstream,
limit_egress = old.upstream,
}
)
uci:save('simple-tc')
break
end
end
end