#!/bin/sh
#
# Booyah another fantabulous script from grifter okt 2k3
#
# Requires: Debian - oh can you feel the love
#
# This one makes a summary overview of the size of each installed package
# so you can easily see which nasty old packages you've forgotten about.
# 

OUTPUT="$2"

doit () {
echo "This will take some time, tail -f $OUTPUT to see progress..."
for i in $( COLUMNS=140 dpkg -l | tail +6 | cut -c 3-34 );
	do echo -n $i >> $OUTPUT
	dpkg -s $i | grep Installed-Size | cut -c 16-40 >> $OUTPUT
	echo "" >> $OUTPUT
done
}

case "$1" in
  -o)
if [ -f $OUTPUT ]; then
echo "File exists, will overwrite!!"
rm $OUTPUT
fi
doit
	;;
   *)
	echo "SYNTAX: $0 -o outputfile.foo"
	echo "WARNING! This will take long time prolly!"
	;;
esac
