+
+ -- Delete old watchdog settings
+ uci:delete_all("olsrd", "LoadPlugin", {library="olsrd_watchdog.so.0.1"})
+
+ -- Write new watchdog settings
+ uci:section("olsrd", "LoadPlugin", nil, {
+ library = "olsrd_watchdog.so.0.1",
+ file = "/var/run/olsrd.watchdog",
+ interval = "30"
+ })
+
+ -- Delete old nameservice settings
+ uci:delete_all("olsrd", "LoadPlugin", {library="olsrd_nameservice.so.0.3"})
+
+ -- Write new nameservice settings
+ uci:section("olsrd", "LoadPlugin", nil, {
+ library = "olsrd_nameservice.so.0.3",
+ suffix = ".olsr",
+ hosts_file = "/var/etc/hosts.olsr",
+ latlon_file = "/var/run/latlon.js",
+ lat = latval and string.format("%.15f", latval) or "",
+ lon = lonval and string.format("%.15f", lonval) or ""
+ })
+
+ -- Save latlon to system too
+ if latval and lonval then
+ uci:foreach("system", "system", function(s)
+ uci:set("system", s[".name"], "latlon",
+ string.format("%.15f %.15f", latval, lonval))
+ end)
+ else
+ uci:foreach("system", "system", function(s)
+ uci:delete("system", s[".name"], "latlon")
+ end)
+ end