452f1213018551f6a388224bbfd1c84ef73b3770
- Author
- Benjamin Boudreau <boudreau.benjamin@gmail.com>
- Committer
- Benjamin Boudreau <boudreau.benjamin@gmail.com>
- Date
Message
Add apt-history to debian plugin
Diff
1diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
2index 09771881dfc255f8c984626e9c6c21b3b87d474a..16a5d54cadb59c99533956e0f1f565531613aa6e 100644
3--- a/plugins/debian/debian.plugin.zsh
4+++ b/plugins/debian/debian.plugin.zsh
5@@ -54,7 +54,7 @@ if [[ $use_sudo -eq 1 ]]; then
6
7 # apt-get only
8 alias ads="sudo $apt_pref dselect-upgrade"
9-
10+
11 # Install all .deb files in the current directory.
12 # Warning: you will need to put the glob in single quotes if you use:
13 # glob_subst
14@@ -113,9 +113,6 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
15 alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
16
17
18-
19-
20-
21 # Functions #################################################################
22 # create a simple script that can be used to 'duplicate' a system
23 apt-copy() {
24@@ -132,11 +129,46 @@ apt-copy() {
25 chmod +x apt-copy.sh
26 }
27
28+# Prints apt history
29+# Usage:
30+# apt-history install
31+# apt-history upgrade
32+# apt-history remove
33+# apt-history rollback
34+# apt-history list
35+# Based On: http://linuxcommando.blogspot.com/2008/08/how-to-show-apt-log-history.html
36+apt-history () {
37+ case "$1" in
38+ install)
39+ zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
40+ ;;
41+ upgrade|remove)
42+ zgrep --no-filename $1 $(ls -rt /var/log/dpkg*)
43+ ;;
44+ rollback)
45+ zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) | \
46+ grep "$2" -A10000000 | \
47+ grep "$3" -B10000000 | \
48+ awk '{print $4"="$5}'
49+ ;;
50+ list)
51+ zcat $(ls -rt /var/log/dpkg*)
52+ ;;
53+ *)
54+ echo "Parameters:"
55+ echo " install - Lists all packages that have been installed."
56+ echo " upgrade - Lists all packages that have been upgraded."
57+ echo " remove - Lists all packages that have been removed."
58+ echo " rollback - Lists rollback information."
59+ echo " list - Lists all contains of dpkg logs."
60+ ;;
61+ esac
62+}
63
64 # Kernel-package building shortcut
65 kerndeb () {
66 # temporarily unset MAKEFLAGS ( '-j3' will fail )
67- MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
68+ MAKEFLAGS=$( print - $MAKEFLAGS | perl -pe 's/-j\s*[\d]+//g' )
69 print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
70 appendage='-custom' # this shows up in $ (uname -r )
71 revision=$(date +"%Y%m%d") # this shows up in the .deb file name