0100-hostname.lua 503 B

1234567891011121314151617181920
  1. local cbi = require "luci.cbi"
  2. local uci = luci.model.uci.cursor()
  3. local M = {}
  4. function M.section(form)
  5. local s = form:section(cbi.SimpleSection, nil, nil)
  6. local o = s:option(cbi.Value, "_hostname", "Name dieses Knotens")
  7. o.value = uci:get_first("system", "system", "hostname")
  8. o.rmempty = false
  9. o.datatype = "hostname"
  10. end
  11. function M.handle(data)
  12. uci:set("system", uci:get_first("system", "system"), "hostname", data._hostname)
  13. uci:save("system")
  14. uci:commit("system")
  15. end
  16. return M