[csw-users] Bulk removal of CSW packages

James Lee james at blastwave.org
Sat Jun 2 12:01:35 CEST 2007


    **** How to bulk remove CSW packages ****


This is a bad idea, do NOT use:
# yes | pkgrm `pkginfo | grep CSW | awk '{print $2}'`


Use this script:
    http://www.blastwave.org/~james/pkgrmAll



CSW packages must be removed in an order constrained by their
dependencies.  This is because preremove scripts may fail if
a prerequisite package has been removed.  This script loops
through the packages and skips until the target package is no
longer needed by another.



This script use an auto admin file to answer the questions.
It either uses the file used by pkg-get or one set in the env as
ADMINFILE.

Usage with pkg-get's default /var/pkg-get/admin:
# ./pkgrmAll

Usage with a different admin file:
# ADMINFILE=auto.admin ./pkgrmAll



Edit the pattern match to change what is removed.  Instead of
"nawk '/CSW/{print $2}'" use eg "nawk '/CSW[^ ]*xfce/{print $2}'"
(Nothing against xfce but I've been rolling it on and off for
testing recently.)  See the commented lines to add exclusions.




James.



More information about the users mailing list