deb-history 837 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #
  2. # Displays dpkg history.
  3. #
  4. # Authors:
  5. # Peter Leung <commandolinux@gmail.com>
  6. # Benjamin Boudreau <boudreau.benjamin@gmail.com>
  7. # Sorin Ionescu <sorin.ionescu@gmail.com>
  8. #
  9. # function deb-history {
  10. case "$1" in
  11. (install)
  12. zgrep --no-filename 'install ' $(ls -rt /var/log/dpkg*)
  13. ;;
  14. (upgrade|remove)
  15. zgrep --no-filename "$1" $(ls -rt /var/log/dpkg*)
  16. ;;
  17. (rollback)
  18. zgrep --no-filename upgrade $(ls -rt /var/log/dpkg*) \
  19. | grep "$2" -A10000000 \
  20. | grep "$3" -B10000000 \
  21. | awk '{print $4"="$5}'
  22. ;;
  23. (list)
  24. zcat $(ls -rt /var/log/dpkg*)
  25. ;;
  26. (*)
  27. cat >&2 <<EOF
  28. Commands:
  29. install - List installed packages
  30. upgrade - List upgraded packages
  31. remove - List removed packages
  32. rollback - List rollback information
  33. list - Display contents of dpkg logs
  34. EOF
  35. ;;
  36. esac
  37. # }