290-legacy-simple-tc 647 B

1234567891011121314151617181920212223242526272829
  1. #!/usr/bin/lua
  2. local site = require 'gluon.site_config'
  3. local sysconfig = require 'gluon.sysconfig'
  4. local uci = require('luci.model.uci').cursor()
  5. if sysconfig.gluon_version == 'legacy' then
  6. for _, config in ipairs(site.legacy.tc_configs) do
  7. local s = uci:get_first(config, 'bandwidth')
  8. if s then
  9. old = uci:get_all(config, s)
  10. uci:section('gluon-simple-tc', 'interface', 'mesh_vpn',
  11. {
  12. ifname = 'mesh-vpn',
  13. enabled = old.enabled,
  14. limit_ingress = old.downstream,
  15. limit_egress = old.upstream,
  16. }
  17. )
  18. uci:save('gluon-simple-tc')
  19. uci:commit('gluon-simple-tc')
  20. break
  21. end
  22. end
  23. end