Re: check if a newer version of a package is available
On Sat, 14 Feb 2015, kamaraju kusumanchi wrote:
> 1) How do I check if a newer version of a package is available from a
> perl script?
I'm not sure there but my guess would be to use one of the CPAN modules
related to APT, perhaps Linux::APT
> 2) Generalizing the previous question, is there any way to get the
> version number of the package to which it will be upgraded to had I
> run "sudo apt-get install PACKAGE"?
"apt-cache" would do that. For xterm,
apt-cache policy xterm
or something like this
apt-cache policy xterm \
| awk '$1 == "Installed:" { installed = $2 } \
$1 == "Candidate:" { candidate = $2 } \
END { if ( installed < candidate ) { print candidate } \
else { print 0 } }'
Regards,
/Lars
Reply to: