apt-get – How to complain on failed upgrade?

I’m trying to write a script to upgrade a bunch of remote machines and would like to verify that one package in particular is upgraded.

With yum, I could say yum upgrade specific-package, and it would complain if it fails to upgrade the package. With apt, as far as I know, I can only say apt-get upgrade, and if apt fails to find the new version or fails to resolve the dependencies for the new version, it will silently decide not to install it.

Is there any way to get apt-get to complain if it decides to not upgrade a package (short of scripting a call to dpkg --compare-versions)?

Asked By: Josh Kelley

||

You can use apt-get install to do what you want. The apt-get manpage says the following:

This is also the target to use if you want to upgrade one or more
already-installed packages without upgrading every package you have
on your system. Unlike the “upgrade” target, which installs the
newest version of all currently installed packages, “install” will
install the newest version of only the package(s) specified. Simply
provide the name of the package(s) you wish to upgrade, and if a
newer version is available, it (and its dependencies, as described
above) will be downloaded and installed.

If you are wanting to install a known version of a package you can specify that on the commandline too.

apt-get install apache2=2.2.14-5ubuntu8.3
Answered By: Richm
Categories: Answers Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.