summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-simple-adblock/luasrc
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.net>2020-04-21 00:44:35 +0000
committerStan Grishin <stangri@melmac.net>2020-04-21 00:56:03 +0000
commit80a280835c4398fb002715cc4c6fc1b26c6be74a (patch)
tree4b8251e03392a894e9fced907a13797182bf4d9f /applications/luci-app-simple-adblock/luasrc
parent398b19832c9db866870baf3833d09bb00838e45b (diff)
luci-app-simple-adblock: bugfix: get package version from opkg
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-simple-adblock/luasrc')
-rw-r--r--applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua14
1 files changed, 5 insertions, 9 deletions
diff --git a/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua b/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua
index 408d070262..1095d5edc2 100644
--- a/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua
+++ b/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua
@@ -49,8 +49,9 @@ elseif targetDNS == "unbound.adb_list" then
outputGzip="/etc/" .. packageName .. ".unbound.gz"
end
+local packageVersion = packageName .. " " .. tostring(util.trim(sys.exec("opkg list-installed " .. packageName .. " | awk '{print $3}'")))
local tmpfs, tmpfsMessage, tmpfsError, tmpfsStats
-local tmpfsVersion, tmpfsStatus = "", "Stopped"
+local tmpfsStatus = "statusStopped"
if fs.access("/var/run/" .. packageName .. ".json") then
tmpfs = jsonc.parse(util.trim(sys.exec("cat /var/run/" .. packageName .. ".json")))
end
@@ -68,11 +69,6 @@ if tmpfs and tmpfs['data'] then
if tmpfs['data']['stats'] and tmpfs['data']['stats'] ~= "" then
tmpfsStats = tmpfs['data']['stats']
end
- if tmpfs['data']['version'] and tmpfs['data']['version'] ~= "" then
- tmpfsVersion = packageName .. " " .. tmpfs['data']['version']
- else
- tmpfsVersion = packageName
- end
end
local statusTable = {}
@@ -111,7 +107,7 @@ m.on_after_apply = function(self)
sys.call("/etc/init.d/simple-adblock restart")
end
-h = m:section(NamedSection, "config", "simple-adblock", translatef("Service Status [%s]", tmpfsVersion))
+h = m:section(NamedSection, "config", "simple-adblock", translatef("Service Status [%s]", packageVersion))
if tmpfsStatus == "statusStarting" or
tmpfsStatus == "statusRestarting" or
@@ -143,7 +139,7 @@ else
ss = h:option(DummyValue, "_dummy", translate("Service Status"))
ss.template = "simple-adblock/status"
if tmpfsStatus == "statusSuccess" then
- ss.value = translatef("%s is blocking %s domains (with %s).", tmpfsVersion, util.trim(sys.exec("wc -l < " .. outputFile)), targetDNS)
+ ss.value = translatef("%s is blocking %s domains (with %s).", packageVersion, util.trim(sys.exec("wc -l < " .. outputFile)), targetDNS)
else
ss.value = statusTable[tmpfsStatus]
end
@@ -167,7 +163,7 @@ else
end
end
end
- if tmpfsVersion ~= "" then
+ if packageVersion ~= "" then
buttons = h:option(DummyValue, "_dummy")
buttons.template = packageName .. "/buttons"
end