[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question about cleaning up packages after upgrade



Marc Espie writes:
 > If you haven't already, you should also look at specific
 > openbsd26/openbsd28 directories.
 > 
 > subdirectories of
 > /usr/lib/gcc-lib
 > /usr/lib/perl* (old)
 > and
 > /usr/libdata/perl*
 > come to mind.


For everything that is NOT in /usr/local you can use this little script
to find out what old cruft you have in your tree.

It finds all of your directories/files (less those it's told to skip) and
then diffs it against the current distribution sets.   The output, in unidiff
format, lists with a + those things you have extra and a - those things you
don't have or told the find to skip.   It requires the source -- at least
/usr/src/distrib/sets -- to work.   Modify the list of dirs to exclude for
your system.

Note: the distribution sets often lag recent changes by a day or
three, so don't be in too much of a hurry to delete something unless
you are sure that it is old cruft that is no longer needed.

Enjoy,

// marc

#! /bin/sh
#

#set -x
set -e

wrk=$(mktemp /tmp/wrk.XXXXXXXX)
req=$(mktemp /tmp/req.XXXXXXXX)

trap "rm -f $wrk $req" EXIT ERR

cd /usr/src/distrib/sets
csh makeflist > $wrk
cd /usr/src/X11/distrib/sets
csh makeflist >> $wrk
sort -u $wrk > $req

cd /
find . \( -type d -o -type f -o -type l \) -a \
      ! \( -path ./cdrom -prune -o \
	   -path ./emul -prune -o \
	   -path './home/*' -prune -o \
	   -path ./usr/lib/debug -prune -o \
	   -path ./usr/local -prune -o \
	   -path ./usr/ports -prune -o \
	   -path ./usr/src -prune -o \
	   -path ./usr/obj -prune -o \
	   -path './usr[0-9]' -prune -o \
	   -path ./var/backups -prune -o \
	   -path ./var/db -prune -o \
	   -path ./var/log -prune -o \
	   -path './var/spool/ftp/*' -prune -o \
	   -path ./var/www/htdocs/ -prune -o \
	   -path ./var/www/logs -prune -o \
	   -path './tmp/*' -prune \
        \) -print | \
sort | diff -u $req -

exit 0