Hi Hamish,

> I was wondering if any of you had found a good way to list all
> installed packages from a particular source (eg the "restricted"
> component) on Debian-based systems? Basically I want to do this so I
> can programmatically check exactly which non-OSS packages are
> installed w/o there being any risk of me missing one, and without
> going through every single package manually.

I don't think Debian's APT packaging system records where it installed a
package from.  You can look instead at where that package is available
now.  Not quite the same thing.  I could be wrong, my main system hasn't
been APT-based for a while.

This gives you a start.

    cd /var/lib/apt/lists &&
    fgrep -xf <(dpkg-query -Wf 'Package: ${package}\n') *_Packages

It takes a list of installed packages and looks for the matching lines
in the indexes of what's available.  That means they're sorted by
source, which is handy.  The bad news is you get duplicates because some
packages are available in i386 and amd64.  Also, you need to check that
every package you have installed has been found, so that command needs
expanding a little with some more checks.

-- 
Cheers, Ralph.

-- 
  Next meeting: BEC, Bournemouth, Tuesday, 2019-04-02 20:00
  Check to whom you are replying
  Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk/
  New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to