Ubuntu – Limit recursion in apt-get install –install-suggests

aptpackage-management

Recently I tried to install a package and it's suggests by using

apt-get install tuxguitar --install-suggests

although this worked, there was far more installed than I bargained for. A total of 1308 packages were installed, including PovRay, Fortran, TexLive, Apache2, gnucash… You get the picture. None of these items were in the install-suggests list as presented by apt-get install tuxguitar, so I must assume that the --install-suggests option recursively looks at the packages requested and their install-suggests until a 'full' set of packages is created.

Is there a clean method of limiting this recursion?

It's not that I'm really complaining much about some of the programs (I like PovRay), but I like adding to my system a little at a time, trying to make sure that the OS is staying stable!

Best Answer

You can install only the directly suggested packages with

LANG=c apt-cache depends tuxguitar|grep -i suggests

(LANG=c to get the english output)

PACKAGES="tuxguitar otherpackage"
SUGGESTS=$(LANG=c apt-cache depends $PACKAGES|grep -i suggests|cut -d' ' -f4|xargs)
sudo apt-get install $PACKAGES $SUGGESTS

in your case and in one line:

PACKAGES=tuxguitar; sudo apt-get install $PACKAGES $(LANG=c apt-cache depends $PACKAGES|grep -i suggests|cut -d' ' -f4|xargs)
Related Question