Score:0

Install a package from a .deb file with apt, but do not downgrade

bg flag

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?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.