olsr4.lua 1004 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. ol.acl_depends = { "luci-app-olsr" }
  14. entry(
  15. {"admin", "services", "olsrd", "iface"},
  16. cbi("olsr/olsrdiface")
  17. ).leaf = true
  18. entry(
  19. {"admin", "services", "olsrd", "hna"},
  20. cbi("olsr/olsrdhna"), _("HNA Announcements")
  21. )
  22. oplg = entry(
  23. {"admin", "services", "olsrd", "plugins"},
  24. cbi("olsr/olsrdplugins"), _("Plugins")
  25. )
  26. oplg.leaf = true
  27. oplg.subindex = true
  28. local uci = require("luci.model.uci").cursor()
  29. uci:foreach("olsrd", "LoadPlugin",
  30. function (section)
  31. local lib = section.library
  32. entry(
  33. {"admin", "services", "olsrd", "plugins", lib },
  34. cbi("olsr/olsrdplugins"),
  35. nil --'Plugin "%s"' % lib:gsub("^olsrd_",""):gsub("%.so.+$","")
  36. )
  37. end
  38. )
  39. end