summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2011-11-10 12:25:58 +0000
committerManuel Munz <freifunk@somakoma.de>2011-11-10 12:25:58 +0000
commita196198fb9e5860d3bd04b54e348bae7c436ebc6 (patch)
treea8a862c1ffb6f57d4f9fecf9e0afc65c6013652f /modules
parentffdeb77e8461a112b98d29eacf4da28194256c2b (diff)
admin-full: Add timeserver section if it doesn't already exist in /etc/config/system (#329)
Diffstat (limited to 'modules')
-rw-r--r--modules/admin-full/luasrc/model/cbi/admin_system/system.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_system/system.lua b/modules/admin-full/luasrc/model/cbi/admin_system/system.lua
index 1f488dac2..5712f7d6b 100644
--- a/modules/admin-full/luasrc/model/cbi/admin_system/system.lua
+++ b/modules/admin-full/luasrc/model/cbi/admin_system/system.lua
@@ -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