[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt logs

On Wed, Feb 27, 2002 at 01:03:59PM -0500, Scott Henson wrote:
> Is there anyway to keep a log of what exactly has been upgraded and
> installed, and when it was upgraded or installed.  I am just wondering
> this because it might be useful if I ever do an upgrade and it screws
> everything up.  I am asking now as kind of preventive medicine in case I
> do ever screw anything up.  I would like to maybe record the exact
> command issued and what was installed because of that command.  Is there
> any program or script already able to do this, or am I going to have to
> write it myself.  Thankyou for anyhelp.

Here is a simple shell script I run after each apt or dselect run that
may be helpful.  It basically keeps a text file of what package's are
currently installed (dpkg -L), which I find faster to grep through when
I'm looking for something anyway (than using dpkg -S).

The next time the script is run, it uses diff to find the differences
between the current and last runs, and appends it to a 'history' file.
So for each date/time apt is run, you can see what packages were added,
removed or upgraded (along with their versions/descriptions).


# Script that writes current list of packages installed
# from /var/lib/dpkg/available to pkgs_woody.current.
# Keeps a history of changes between package versions
# in woody_history.txt.


if [ -f 'woody_history.txt.gz' ]; then
	gunzip woody_history.txt.gz
if [ -f 'pkgs_woody.current' ]; then
	mv pkgs_woody.current pkgs_woody.last
	COLUMNS=120 dpkg -l | grep "^i" | cut -b 5- > pkgs_woody.current
	diff -C 0 pkgs_woody.last pkgs_woody.current >> woody_history.txt
gzip woody_history.txt
rm -f pkgs_woody.last


Larry Holish

Reply to: