luci-0.10: Merge r7913
authorManuel Munz <freifunk@somakoma.de>
Thu, 10 Nov 2011 12:26:52 +0000 (12:26 +0000)
committerManuel Munz <freifunk@somakoma.de>
Thu, 10 Nov 2011 12:26:52 +0000 (12:26 +0000)
modules/admin-full/luasrc/model/cbi/admin_system/system.lua

index 1f488dac265192789cce4aa0e2f3134b595b4de2..5712f7d6b1fbc7007f1c1d326ba697f7844a9d17 100644 (file)
@@ -22,7 +22,6 @@ require("luci.config")
 local m, s, o
 local has_ntpd = luci.fs.access("/usr/sbin/ntpd")
 
-
 m = Map("system", translate("System"), translate("Here you can configure the basic aspects of your device like its hostname or the timezone."))
 m:chain("luci")
 
@@ -159,6 +158,20 @@ if has_ntpd then
        s.anonymous = true
        s.addremove = false
 
+       function m.on_parse()
+               local has_section = false
+
+               m.uci:foreach("system", "timeserver",
+                       function(s)
+                               has_section = true
+                               return false
+               end)
+
+               if not has_section then
+                       m.uci:section("system", "timeserver", "ntp")
+               end
+       end
+
        o = s:option(Flag, "enable", translate("Enable builtin NTP server"))
        o.rmempty = false