X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=applications%2Fluci-app-ddns%2Fluasrc%2Fmodel%2Fcbi%2Fddns%2Foverview.lua;h=6ba3ea0dd846e23e0b786b38d0cb7f3aefdf9973;hb=475b74b9bf611088a6b1c9ab81d02fd3b0eb8362;hp=e6da7cc1889cbdfda1c398446c0291bd62a911b7;hpb=6982bbb3fef11c0817c5674db2082fe87ba11a92;p=project%2Fluci.git diff --git a/applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua b/applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua index e6da7cc18..6ba3ea0dd 100644 --- a/applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua +++ b/applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua @@ -33,15 +33,18 @@ m.description = CTRL.app_description() m.on_after_commit = function(self) if self.changed then -- changes ? + local command = CTRL.luci_helper if SYS.init.enabled("ddns") then -- ddns service enabled, restart all - os.execute("/etc/init.d/ddns restart") + command = command .. " -- restart" + os.execute(command) else -- ddns service disabled, send SIGHUP to running - os.execute("killall -1 dynamic_dns_updater.sh") + command = command .. " -- reload" + os.execute(command) end end end --- SimpleSection definiton -- ################################################## +-- SimpleSection definition -- ################################################## -- with all the JavaScripts we need for "a good Show" a = m:section( SimpleSection ) a.template = "ddns/overview_status" @@ -52,7 +55,7 @@ if show_hints or need_update or not_enabled then s = m:section( SimpleSection, translate("Hints") ) - -- ddns_scripts needs to be updated for full functionality + -- ddns-scripts needs to be updated for full functionality if need_update then local dv = s:option(DummyValue, "_update_needed") dv.titleref = DISP.build_url("admin", "system", "packages") @@ -119,18 +122,21 @@ function dom.set_one(self, section) end end function dom.set_two(self, section) - local lookup = self.map:get(section, "lookup_host") or "" - if lookup == "" then return "" end + local lookup_host = self.map:get(section, "lookup_host") or "" + if lookup_host == "" then return "" end local dnsserver = self.map:get(section, "dnsserver") or "" local use_ipv6 = tonumber(self.map:get(section, "use_ipv6") or 0) local force_ipversion = tonumber(self.map:get(section, "force_ipversion") or 0) local force_dnstcp = tonumber(self.map:get(section, "force_dnstcp") or 0) - local command = [[/usr/lib/ddns/dynamic_dns_lucihelper.sh]] - if not NXFS.access(command, "rwx", "rx", "rx") then - NXFS.chmod(command, 755) - end - command = command .. [[ get_registered_ip ]] .. lookup .. [[ ]] .. use_ipv6 .. - [[ ]] .. force_ipversion .. [[ ]] .. force_dnstcp .. [[ ]] .. dnsserver + local is_glue = tonumber(self.map:get(section, "is_glue") or 0) + local command = CTRL.luci_helper .. [[ -]] + if (use_ipv6 == 1) then command = command .. [[6]] end + if (force_ipversion == 1) then command = command .. [[f]] end + if (force_dnstcp == 1) then command = command .. [[t]] end + if (is_glue == 1) then command = command .. [[g]] end + command = command .. [[l ]] .. lookup_host + if (#dnsserver > 0) then command = command .. [[ -d ]] .. dnsserver end + command = command .. [[ -- get_registered_ip]] local ip = SYS.exec(command) if ip == "" then ip = translate("no data") end return ip