0

On Ubuntu 18.04, I can install a .deb file with apt install ./filename.deb (or dpkg -i filename.deb && apt-get install -f). If there is version of this package installed, I get this warning:

...
The following packages will be DOWNGRADED:
  package-name
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
...

I want to script the installation of this deb. How can I automatically answer “No” if there's a downgrade? I don't want to ever downgrade anything.

i.e. I want the deb installed only if the package isn't installed, or the installed version is older than the version from the deb file.

I think I could do this with dpkg-query in a script. Is there an apt/apt-get/dpkg command line flag instead?

Amandasaurus
  • 30,211
  • 62
  • 184
  • 246

0 Answers0