1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
-- apk library
module (..., package.seeall)
require("subprocess")
delete = function(package)
local success = false
local code, cmdresult = subprocess.call_capture({"apk", "del", package, stderr=subprocess.STDOUT})
if string.find(cmdresult, "^OK") then
cmdresult = "ERROR: Package not found\n"..cmdresult
elseif not string.find(cmdresult, "ERROR") then
success = true
end
return success, cmdresult
end
install = function(package)
local success = true
local code, cmdresult = subprocess.call_capture({"apk", "add", package, stderr=subprocess.STDOUT})
if string.find(cmdresult, "^ERROR") then
success = false
end
return success, cmdresult
end
version = function(package)
local code, cmdresult = subprocess.call_capture({"apk", "info", "-ve", package, stderr=subprocess.STDOUT})
if string.find(cmdresult, "^%s*$") then
cmdresult = nil
end
return cmdresult
end
|