Closed JakobDev closed 6 years ago
You'd be better off interfacing directly with the package API. Packman's procedure for checking for updates may be useful reference material.
I had get the datas with packamn update. For anybody who are interest, here are the code:
updateta = {} local function lookUpdates() local updatesa = {} updatesa.shell = shell updatesa.io = {write = getUpdatePrint,read = ioread} updatetmp = fs.open("/tmp/update.tmp","w") os.run(updatesa,"/usr/bin/packman","update") updatetmp.close() updatere = fs.open("/tmp/update.tmp","r") updatere.readLine() updatere.readLine() local updatelist = updatere.readLine() updatere.close() fs.delete("/tmp/update.tmp") if updatelist:find("Nothing") == 1 then return end updatelist = updatelist:sub(41,-1) local returnstr = "" for i = 1,#updatelist do local c = updatelist:sub(i,i) if c == " " then table.insert(updateta,returnstr) returnstr = "" else returnstr = returnstr..c end end end
This is include in the newest Version of Mynaptic. You can get it with packman install mynaptic.
btw: Why is the APi package are instaled to /usr/bin and not to /usr/apis?
Whoops, it was supposed to target /usr/apis
. I've fixed that.
If you changed over to using the package API directly, instead of going through packman, you'd be able to get the list of packages that have updates available without needing to even have the packman package installed (just the package API package and mynaptic), and you wouldn't be reliant on the layout of the text in the packman update message. This would be a more reliable method and should work better overall. It's certainly more future-proof, as the text output of packman could change at any time.
I'm working on a GUI for packman called Mynaptic. I get the Info of the package with packman search. It is possible, to show,if a package can be updated 8e.g. with a U) in packman search so I can esay ask for it?