How do I find the most recent version of a package in the repositories in a shell script? If I use apt-cache-policy
, I get the installed version as "Candidate", not the most recent one from the repositories.
apt-cache policy nvidia-current
shows:
nvidia-current:
Installed: 280.13-0ppa~natty1
Candidate: 280.13-0ppa~natty1
Version table:
*** 280.13-0ppa~natty1 0
100 /var/lib/dpkg/status
270.41.06-0ubuntu1 0
500 http://archive.ubuntu.com/ubuntu/ natty/restricted amd64 Packages
It looks like the installed version is marked with ***
, so that one must be ignored. Perhaps there is an awk script that could be used?
ppa-purge
. I forgot to mention that no new packages may be installed. (background: a PPA contained anvidia-current
package which was flawed and broke GL on the system. Such broken packages needs to be up/downgraded to a version which does not include that flaw. The PPA has already been removed as it contains conflicting packages. See also github.com/Bumblebee-Project/Bumblebee/blob/develop/cleanup#L89)