On Tue, Aug 04, 2009 at 11:11:17AM -0400, Luis Useche wrote: > Hello Guys, > > I was wondering if there is some tool that delete the packages > specified along with their "deletable" dependencies. Deletable means > packages that pkg_add added automatically (as dependencies of the > installed one) and are not dependency of another package. This will > ensure (in most of the cases) that you don't end up with a system with > unnecessary packages. > > I couldn't find in pkg_delete(1) any option that implements the > previous semantic.
I have this script: --8<---- #!/bin/sh pkg_info -t \ | gawk '! /^(bzip2|gawk|net-snmp|rsync|screen|tree|vim)/ {print "pkg_delete "$1}' --8<---- If I run it, I have a series of pkg_delete commands to remove all the leaf packages not excluded by the regular expression. If I see something I know I want to keep I modify the RE and re-run it. When I am satisfied a simple "| sh" at the end cleans the system up. Repeat until you see no more output. HTH, D.