modules/admin-full: display kernel version
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_system / system.lua
index 891e48e..7851f05 100644 (file)
@@ -19,20 +19,13 @@ require("luci.fs")
 
 m = Map("system", translate("System"), translate("Here you can configure the basic aspects of your device like its hostname or the timezone."))
 
-function m.on_parse()
-       local has_rdate = false
-
-       m.uci:foreach("system", "rdate",
-               function()
-                       has_rdate = true
-                       return false
-               end)
-
-       if not has_rdate then
-               m.uci:section("system", "rdate", nil, { })
-               m.uci:save("system")
-       end
-end
+local has_rdate = false
+
+m.uci:foreach("system", "rdate",
+       function()
+               has_rdate = true
+               return false
+       end)
 
 
 s = m:section(TypedSection, "system", "")
@@ -45,6 +38,9 @@ local uptime = luci.sys.uptime()
 s:option(DummyValue, "_system", translate("System")).value = system
 s:option(DummyValue, "_cpu", translate("Processor")).value = model
 
+s:option(DummyValue, "_kernel", translate("Kernel")).value =
+ luci.util.exec("uname -r") or "?"
+
 local load1, load5, load15 = luci.sys.loadavg()
 s:option(DummyValue, "_la", translate("Load")).value =
  string.format("%.2f, %.2f, %.2f", load1, load5, load15)
@@ -100,10 +96,12 @@ s:option(Value, "log_port", translate("External system log server port")).option
 s:option(Value, "conloglevel", translate("Log output level")).optional = true
 s:option(Value, "cronloglevel", translate("Cron Log Level")).optional = true
 
-s2 = m:section(TypedSection, "rdate", translate("Time Server (rdate)"))
-s2.anonymous = true
-s2.addremove = false
+if has_rdate then
+       s2 = m:section(TypedSection, "rdate", translate("Time Server (rdate)"))
+       s2.anonymous = true
+       s2.addremove = false
 
-s2:option(DynamicList, "server", translate("Server"))
+       s2:option(DynamicList, "server", translate("Server"))
+end
 
 return m