Subject: A script for those who meta-pkg a whole machine
To: None <tech-pkg@netbsd.org>
From: Todd Vierling <tv@duh.org>
List: tech-pkg
Date: 04/16/2004 14:36:41
If you ever wanted to know what packages have zero packages depending on
them, try the following.  This is most useful if you meta-pkg entire
machines and want to know what packages are not being tracked by the
meta-pkg -- either because they became orphaned after a "make replace", or
because they were added and the meta-pkg wasn't updated to match.

(I've found that, in addition to the cleanliness factor above, meta-pkg'ing
entire machines becomes very useful to help rebuild a machine whose /usr/pkg
containing drive keeled over.  8-)

===== BEGIN =====
#!/bin/sh

: ${PKG_DBDIR:=/var/db/pkg}

dir=$(mktemp -d -t pkgdepchk)
test -n "$dir" || exit 1
trap 'rm -rf $dir' 0
trap 'exit 1' 1 2 3 5 15
cd $dir

(cd $PKG_DBDIR && find . -name +REQUIRED_BY -size +1c | sed 's,^./,,;s,/.*$,,') | sort >deps.registered
(cd $PKG_DBDIR && /bin/ls -1d *-*) | sort >deps.available

comm -13 deps.registered deps.available
===== END =====

-- 
-- Todd Vierling <tv@duh.org> <tv@pobox.com>