Can I get "--no-install-recommends" behavior with a setting in the Debian "control" file?
I'm looking for a way to build direction into my Debian package (say, in the control
file or elsewhere) that will tell apt-get install
to behave as though I had included the --no-install-recommends
flag.
Back Story
I manage a package - call it foo
- that explicitly depends on three other packages (they are libcuda1-340
, nvidia-340
and nvidia-opencl-icd-340
, BTW, if knowing that helps). When I try to install foo
using...
apt-get install foo
...it winds up trying to install a long list of other packages that I don't want, and that in fact break my machine. I have found that if I instead do...
apt-get install --no-install-recommends foo
...it installs foo
and the three explicit dependencies and nothing else, and that gets me the end result I want.
Perfect!
But here's the twist: I can't use the --no-install-recommends
flag.
That's because...
- the
apt-get install
is being done for me by a tool that I don't really control, - that tool also installs many other packages besides
foo
for me, and - I only want the
--no-install-depends
behavior with respect to packagefoo
. In all other cases I want to bring the dependencies in, too.
The question: So, is there some directive I can put in package foo
's debian/control
file or elsewhere that would get me this behavior, only for package foo
?
Thanks in advance for your guidance.
Steve
Solution 1:
To accomplish the same thing on our Trusty LTS servers, I put these in /etc/apt/apt.conf
APT::Install-Recommends "0";
Similarly, for "suggested" packages
APT::Install-Suggests "0";
Solution 2:
Use a "conflicts" and/or "breaks" control field listing to prevent installation of packages that will cause breakage.
Packages can declare in their control file that they have certain relationships to other packages - for example, that they may not be installed at the same time as certain other packages, and/or that they depend on the presence of others.
This is done using the Depends, Pre-Depends, Recommends, Suggests, Enhances, Breaks and Conflicts control fields.
- Source: Debian Policy Manual, Chapter 7
This means that you will need to narrow down the list of packages to those that actually cause breakage.
You, as the packager, don't get to decide the apt settings on the end user's system.