-- 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")
-- 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
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