View Single Post
free's Avatar
Posts: 739 | Thanked: 159 times | Joined on Sep 2007 @ Germany - Munich
#24
Well, there's the question about the logs. IIRC (and no debian around here to check), aptitude puts a lot of history in /var/log
Actually I like it to track problems, you know what was last updated...
I've done a simple script to grep through it

Code:
#!/bin/sh
[[ $1 == -h ]] &&  { echo "

# version: 0.5
# date: 2009-03-05

# usage:
# ./script will display packages status of the current day
# ./script <regexp> will display a summary of packages status with line containing <regexp>
#
# examples:
# ./script 2007-04-13          lists changed package statuses on this day
# ./script locales             lists changes on package locales
# ./script 2007-04-12.*upgrade lists only upgraded packages on the day before
# ./script ^2007|less -R       list the history of the year
" ; exit ; }
pattern=${1:-`date +%Y-%m-%d`}
for i in `ls -1r /var/log/dpkg.log*` ; do (
	zcat -f  $i | egrep $pattern | \
	awk ' BEGIN { RED=31; GREEN=33 ; BLUE= 34 }
	 { f1=" "; f2=" "; f3=" "; }
	 /upgrade\ /       { stat="  U" ; col=GREEN; f1=$4; f2=$5; f3=$6; }
	 /not-installed/ { stat="- D" ; col=RED ;  f1=$5 }
	 /config-files/  { stat="- C" ; col=RED ;  f1=$5; f2=$6 }
	 / install.*</   { stat="+ I";  col=BLUE ; f1=$4; f3=$6 }
	 {
	   if (f1!=" ") printf("%s %s: \033[0;%dm%s\033[0m %*s %*s %*s\n",$1,$2,col,stat,30,f1,40,f2,40,f3); 
	 }
	' | uniq
)
done
Displays nice colors

Last edited by free; 2009-04-22 at 18:05. Reason: upgrade becomes upgrade\