3 local uci = require "luci.model.uci"
6 local update_url = "http://www.layereight.de/freifunkmap.php?update=%.15f,%.15f&olsrip=%s¬e=%s&robot=%s"
7 local update_all = ( arg[1] and arg[1] == "all" ) and true or false
10 x:foreach("olsrd", "LoadPlugin", function(s)
11 if s.library == "olsrd_nameservice.so.0.3" then
12 file = io.open(s.latlon_file)
21 if not ln then break end
22 if update_all and ln:match("^Node%(") then
23 local ip, lat, lon, note = ln:match("Node%('(%S+)',([%d%.]+),([%d%.]+),%d+,'%S+','(%S+)'%)")
27 if ip and lat ~= 0.0 and lon ~= 0.0 and note then
28 note = note:gsub("[^%w%-%.]+", "_")
29 os.execute("wget -qO/dev/null %q" % string.format(update_url, lat, lon, ip, note, "luci-massupdate"))
33 elseif ln:match("^Self%(") then
34 local ip, lat, lon, note = ln:match("Self%('(%S+)',([%d%.]+),([%d%.]+),%d+,'%S+','(%S+)'%)")
38 if ip and lat ~= 0.0 and lon ~= 0.0 and note then
39 note = note:gsub("[^%w%-%.]+", "_")
40 os.execute("wget -qO/dev/null %q" % string.format(update_url, lat, lon, ip, note, "luci-selfupdate"))
46 os.execute("logger -t 'mapupdate' 'Updated %d entries in freifunk map'" % count)