Created
November 18, 2011 22:16
-
-
Save rduplain/1377951 to your computer and use it in GitHub Desktop.
Produce CSV of each installed package and full copyright of each package. (Debian/Ubuntu)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Produce CSV of each installed package and full copyright of each package. (Debian) | |
# | |
# Sample CSV: | |
# Package,Version,Section,Homepage,Source | |
# bash,4.1-2ubuntu3,shells,http://tiswww.case.edu/php/chet/bash/bashtop.html, | |
# git-core,1:1.7.0.4-1ubuntu0.2,vcs,, | |
# python,2.6.5-0ubuntu1,python,,python-defaults | |
AUDIT_DIR="${HOSTNAME}-package-audit/`date +'%Y-%m-%d'`" | |
echo "Placing audit files in $AUDIT_DIR" 1>&2 | |
mkdir -p $AUDIT_DIR | |
echo 'Package,Version,Section,Homepage,Source' > $AUDIT_DIR/packages.csv | |
dpkg-query -Wf '${Package},${Version},${Section},${Homepage},${Source}\n' | sort -n >> $AUDIT_DIR/packages.csv | |
for package in `dpkg-query -Wf '${Package} '`; do | |
cp /usr/share/doc/$package/copyright $AUDIT_DIR/${package}-copyright.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment