diff options
author | Stan Grishin <stangri@melmac.net> | 2020-09-21 18:37:02 +0000 |
---|---|---|
committer | Stan Grishin <stangri@melmac.net> | 2020-09-21 18:37:02 +0000 |
commit | b0fe4bf371b21e05b03e8c4a875d80a198dd3d45 (patch) | |
tree | 9d6137d760ccc85b93c91e4ddbcb28afe3a7258b /applications/luci-app-vpn-policy-routing/luasrc/model/cbi | |
parent | 073b9ba3bdc932d28dbc49fb005e13bea494e610 (diff) |
luci-app-vpn-policy-routing: ACL-related update
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-vpn-policy-routing/luasrc/model/cbi')
-rw-r--r-- | applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua b/applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua index 692c771a43..61c16b1efb 100644 --- a/applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua +++ b/applications/luci-app-vpn-policy-routing/luasrc/model/cbi/vpn-policy-routing.lua @@ -13,6 +13,20 @@ local dispatcher = require "luci.dispatcher" local enabledFlag = uci:get(packageName, "config", "enabled") local enc +function getPackageVersion() + local opkgFile = "/usr/lib/opkg/status" + local line + local flag = false + for line in io.lines(opkgFile) do + if flag then + return line:match('[%d%.$-]+') or "" + elseif line:find("Package: " .. packageName:gsub("%-", "%%%-")) then + flag = true + end + end + return "" +end + local ubusStatus = util.ubus("service", "list", { name = packageName }) if ubusStatus and ubusStatus[packageName] and ubusStatus[packageName]["instances"] and @@ -33,7 +47,7 @@ if ubusStatus and ubusStatus[packageName] and end local serviceRunning, statusText = false, nil -local packageVersion = tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'"))) or "" +local packageVersion = getPackageVersion() if packageVersion == "" then statusText = translatef("%s is not installed or not found", packageName) end @@ -78,7 +92,7 @@ if (type(lanIPAddr) == "table") then break end lanIPAddr = lanIPAddr:match("[0-9.]+") -end +end if lanIPAddr and lanNetmask then laPlaceholder = ip.new(lanIPAddr .. "/" .. lanNetmask ) end |