Re: 'rpm --freshen': dpkg Equivalent?
On Sun, 07 Nov 2004 11:05:01 -0500
Kenneth Jacker <firstname.lastname@example.org> wrote:
> How can I use 'dpkg' to install a new .deb, but *only* if the package
> is already on a machine? With RPM, you can use the "freshen" option
> ("-F" or "--freshen"). But how with 'dpkg'?
> In other words:
> o If the package is already installed, then update it
> o If the package is not installed, do nothing (do *not* install it)
You may succeed with one of the following two suggestions (change syntax of "if" according to shell)
if (dpkg -l package-name | grep -c ii ) apt-get install package-name;
if (dpkg -l package-name | grep -c ii ) dpkg -i ./package.deb;
But I still don't understand why you wish to do all this. In most cases it is easier to upgrade all packages at once:
apt-get update && apt-get upgrade