6

There are some similar questions, but here is precisely what I would like to achieve and the dots which I am having trouble connecting:

  1. Query a list of "Manually Installed" packages (apt-mark showmanual works)
  2. Check each package for installed dependents
  3. Mark each such package as "Automatically Installed" (apt-mark auto <pkg ...> works)

So I think my command will look something like:

apt-mark showmanual | <esoteric apt/bash magic> | apt-mark auto -

Would that be correct?

Related Questions

  1. How do I find which packages could be set as automatically installed?
  2. Why are almost all packages marked as manually installed? (See also https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/424643/comments/26)
0

1 Answer 1

2

You could use Aptitude's why command:

for x in $(apt-mark showmanual)
do
  r="$(echo ${x} | sed -e 's/\([+.]\)/[\1]/g')"
  aptitude why ${x} | egrep -q "^i.* (Pre)?Depends +${r}( |$)" && apt-mark auto ${x}
done

Not tested, because it's not something I want to (have to un-)do on my machine.

1
  • The grep above is quite broad. It matches things like: aptitude why vimp vim-migemo Depends vim. The grep should check for lines starting with "i" and having the actual package looked for after it. I have submitted an edit to this answer.
    – Elrond
    Aug 27, 2014 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .