summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorRobby Russell <robby@planetargon.com>2011-12-26 10:31:41 -0800
committerRobby Russell <robby@planetargon.com>2011-12-26 10:31:41 -0800
commitae3f5e4917597cd63cae6d275789421696868422 (patch)
tree70e44a3c99353471cba3d2d14d8320f00e212084 /plugins
parent22b99779d9af031aba96d52c95d71b0f6c11b380 (diff)
parent452f1213018551f6a388224bbfd1c84ef73b3770 (diff)
downloadzsh-ae3f5e4917597cd63cae6d275789421696868422.tar.gz
zsh-ae3f5e4917597cd63cae6d275789421696868422.tar.bz2
zsh-ae3f5e4917597cd63cae6d275789421696868422.zip
Merge pull request #693 from dreur/upstream-debian-apt-history
Add apt-history function to debian plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/debian/debian.plugin.zsh42
1 files changed, 37 insertions, 5 deletions
diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
index 09771881d..16a5d54ca 100644
--- a/plugins/debian/debian.plugin.zsh
+++ b/plugins/debian/debian.plugin.zsh
@@ -54,7 +54,7 @@ if [[ $use_sudo -eq 1 ]]; then
# apt-get only
alias ads="sudo $apt_pref dselect-upgrade"
-
+
# Install all .deb files in the current directory.
# Warning: you will need to put the glob in single quotes if you use:
# glob_subst
@@ -113,9 +113,6 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
-
-
-
# Functions #################################################################
# create a simple script that can be used to 'duplicate' a system
apt-copy() {
@@ -132,11 +129,46 @@ apt-copy() {
chmod +x apt-copy.sh
}
+# Prints apt history
+# Usage:
+# apt-history install
+# apt-history upgrade
+# apt-history remove
+# apt-history rollback
+# apt-history list
+# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
+apt-history () {
+ 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*)
+ ;;
+ *)
+ echo "Parameters:"
+ echo " install - Lists all packages that have been installed."
+ echo " upgrade - Lists all packages that have been upgraded."
+ echo " remove - Lists all packages that have been removed."
+ echo " rollback - Lists rollback information."
+ echo " list - Lists all contains of dpkg logs."
+ ;;
+ esac
+}
# Kernel-package building shortcut
kerndeb () {
# temporarily unset MAKEFLAGS ( '-j3' will fail )
- MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
+ MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
appendage='-custom' # this shows up in $ (uname -r )
revision=$(date +"%Y%m%d") # this shows up in the .deb file name