Uninstall a .pkg

The OS X installer doesn’t offer a default tracking method for the files created by Installer packages (.pkg). While the list of files copied is present within the package, and is saved in /Library/Receipts/packagename, scripts run during install can create/modify others, and I think they can only be detected by running the install chrooted. Anyway, a quick solution to free disk space:
cd /Library/Receipts/packagename/Contents
lsbom -pf Archive.bom | cut -c 2- | sort -r | xargs -I# -p -t rm -d "#" ;

Warnings:
1. this has to be run from a root shell (not sudo)
2. mistake a single letter, and you might wipe the whole system
3. do not try to be clever and add a -fr to the rm above

Bad Behavior has blocked 177 access attempts in the last 7 days.