#!/usr/bin/perl -w # # fix_rpm_remove # # Uninstalling a package with RPM won't remove any files which have # been gzipped. This program processes RPM's error output and gets # rid of any gzipped files it didn't remove. # # -- Ed Avis, epa98@doc.ic.ac.uk, 2000-03-29 # use strict; use diagnostics; while (<>) { if (/^removal of (.+) failed: No such file or directory$/ and -e "$1.gz" ) { unlink "$1.gz" or warn "removal of $1.gz failed: $!\n"; } elsif (/^cannot remove (.+) - directory not empty$/ and -d $1 and (not <$1/*>) ) { rmdir $1 or warn "cannot remove $1 - $!\n"; } else { warn $_ } }