luci-app-ddns: update to version 2.2.0-1
[project/luci.git] / applications / luci-app-ddns / luasrc / tools / ddns.lua
index 2fbcff8..e9c3fa9 100644 (file)
@@ -35,7 +35,7 @@ end
 
 -- check if Wget with SSL support or cURL installed
 function check_ssl()
-       if (SYS.call([[ grep -iq "\+ssl" /usr/bin/wget 2>/dev/null ]]) == 0) then
+       if (SYS.call([[ grep -i "\+ssl" /usr/bin/wget >/dev/null 2>&1 ]]) == 0) then
                return true
        else
                return NXFS.access("/usr/bin/curl")
@@ -45,12 +45,12 @@ end
 -- check if Wget with SSL or cURL with proxy support installed
 function check_proxy()
        -- we prefere GNU Wget for communication
-       if (SYS.call([[ grep -iq "\+ssl" /usr/bin/wget 2>/dev/null ]]) == 0) then
+       if (SYS.call([[ grep -i "\+ssl" /usr/bin/wget >/dev/null 2>&1 ]]) == 0) then
                return true
 
        -- if not installed cURL must support proxy
        elseif NXFS.access("/usr/bin/curl") then
-               return (SYS.call([[ grep -iq all_proxy /usr/lib/libcurl.so* 2>/dev/null ]]) == 0)
+               return (SYS.call([[ grep -i all_proxy /usr/lib/libcurl.so* >/dev/null 2>&1 ]]) == 0)
 
        -- only BusyBox Wget is installed
        else
@@ -121,6 +121,20 @@ function ipkg_ver_installed(pkg)
        return nil
 end
 
+-- get the "name" of the current active theme
+function get_theme()
+       local _uci  = UCI.cursor()
+       local _base = _uci:get("luci", "main", "mediaurlbase")  -- only pathname
+       _uci:unload("luci")
+
+       for k, v in pairs(luci.config.themes) do
+               if k:sub(1, 1) ~= "." and v == _base then
+                       return k
+               end
+       end
+       return nil
+end
+
 -- replacement of build-in read of UCI option
 -- modified AbstractValue.cfgvalue(self, section) from cbi.lua
 -- needed to read from other option then current value definition