olsr4.lua 966 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. module("luci.controller.olsr4", package.seeall)
  2. function index()
  3. if not nixio.fs.access("/etc/config/olsrd") then
  4. return
  5. end
  6. require("luci.model.uci")
  7. local uci = luci.model.uci.cursor_state()
  8. local ol = entry(
  9. {"admin", "services", "olsrd"},
  10. cbi("olsr/olsrd"), "OLSR IPv4"
  11. )
  12. ol.subindex = true
  13. entry(
  14. {"admin", "services", "olsrd", "iface"},
  15. cbi("olsr/olsrdiface")
  16. ).leaf = true
  17. entry(
  18. {"admin", "services", "olsrd", "hna"},
  19. cbi("olsr/olsrdhna"), _("HNA Announcements")
  20. )
  21. oplg = entry(
  22. {"admin", "services", "olsrd", "plugins"},
  23. cbi("olsr/olsrdplugins"), _("Plugins")
  24. )
  25. oplg.leaf = true
  26. oplg.subindex = true
  27. local uci = require("luci.model.uci").cursor()
  28. uci:foreach("olsrd", "LoadPlugin",
  29. function (section)
  30. local lib = section.library
  31. entry(
  32. {"admin", "services", "olsrd", "plugins", lib },
  33. cbi("olsr/olsrdplugins"),
  34. nil --'Plugin "%s"' % lib:gsub("^olsrd_",""):gsub("%.so.+$","")
  35. )
  36. end
  37. )
  38. end