X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=applications%2Fluci-app-privoxy%2Fluasrc%2Fcontroller%2Fprivoxy.lua;h=0cedab48ae80076bf08ba28b90573ab54058da95;hb=c9cd86916830505c1014ce93e648d158a46b7609;hp=9ffc404ce9da74eb237ee173e39a7c6c50f4c8ab;hpb=31e7adea63a4e7174d7f91daa9d323ee78a17a18;p=project%2Fluci.git diff --git a/applications/luci-app-privoxy/luasrc/controller/privoxy.lua b/applications/luci-app-privoxy/luasrc/controller/privoxy.lua old mode 100755 new mode 100644 index 9ffc404ce..0cedab48a --- a/applications/luci-app-privoxy/luasrc/controller/privoxy.lua +++ b/applications/luci-app-privoxy/luasrc/controller/privoxy.lua @@ -15,7 +15,7 @@ PRIVOXY_MIN = "3.0.22-0" -- minimum version of service required function index() entry( {"admin", "services", "privoxy"}, cbi("privoxy"), _("Privoxy WEB proxy"), 59) entry( {"admin", "services", "privoxy", "logview"}, call("logread") ).leaf = true - entry( {"admin", "services", "privoxy", "startstop"}, call("startstop") ).leaf = true + entry( {"admin", "services", "privoxy", "startstop"}, post("startstop") ).leaf = true entry( {"admin", "services", "privoxy", "status"}, call("get_pid") ).leaf = true end @@ -72,8 +72,7 @@ end -- compare versions using "<=" "<" ">" ">=" "=" "<<" ">>" function ipkg_ver_compare(ver1, comp, ver2) - if not ver1 or not (#ver1 > 0) - or not ver2 or not (#ver2 > 0) + if not ver1 or not ver2 or not comp or not (#comp > 0) then return nil end -- correct compare string if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~=" @@ -90,33 +89,19 @@ function ipkg_ver_compare(ver1, comp, ver2) for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do local s1 = av1[i] or "" local s2 = av2[i] or "" - local n1 = tonumber(s1) - local n2 = tonumber(s2) - - -- one numeric and other empty string then set other to 0 - if n1 and not n2 and (not s2 or #s2 == 0) then n2 = 0 end - if n2 and not n1 and (not s1 or #s1 == 0) then n1 = 0 end - - local nc = (n1 and n2) -- numeric compare - - if nc then - -- first "not equal" found return true - if comp == "~=" and (n1 ~= n2) then return true end - -- first "lower" found return true - if (comp == "<" or comp == "<=") and (n1 < n2) then return true end - -- first "greater" found return true - if (comp == ">" or comp == ">=") and (n1 > n2) then return true end - -- not equal then return false - if (n1 ~= n2) then return false end - else - if comp == "~=" and (s1 ~= s2) then return true end - if (comp == "<" or comp == "<=") and (s1 < s2) then return true end - if (comp == ">" or comp == ">=") and (s1 > s2) then return true end - if (s1 ~= s2) then return false end - end + + -- first "not equal" found return true + if comp == "~=" and (s1 ~= s2) then return true end + -- first "lower" found return true + if (comp == "<" or comp == "<=") and (s1 < s2) then return true end + -- first "greater" found return true + if (comp == ">" or comp == ">=") and (s1 > s2) then return true end + -- not equal then return false + if (s1 ~= s2) then return false end end - -- all equal then true - return true + + -- all equal and not compare greater or lower then true + return not (comp == "<" or comp == ">") end -- read version information for given package if installed