From 3c13411dd0b3be4988bb7e1dc42f8b59a2f394f1 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 1 Feb 2012 00:24:37 -0500 Subject: [PATCH] Added the apt-history function to dpkg plugin. --- plugins/dpkg/functions/apt-history | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 plugins/dpkg/functions/apt-history diff --git a/plugins/dpkg/functions/apt-history b/plugins/dpkg/functions/apt-history new file mode 100644 index 0000000..5ae1446 --- /dev/null +++ b/plugins/dpkg/functions/apt-history @@ -0,0 +1,37 @@ +# +# Displays dpkg history. +# +# Authors: +# Peter Leung +# Benjamin Boudreau +# Sorin Ionescu +# + +case "$1" in + (install) + zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*) + ;; + (upgrade|remove) + zgrep --no-filename $1 $(ls -rt /var/log/dpkg*) + ;; + (rollback) + zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \ + grep "$2" -A10000000 | \ + grep "$3" -B10000000 | \ + awk '{print $4"="$5}' + ;; + (list) + zcat $(ls -rt /var/log/dpkg*) + ;; + (*) + cat >&2 <