mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-26 21:51:05 +01:00
Add apt-history to debian plugin
This commit is contained in:
parent
757fa3314d
commit
452f121301
1 changed files with 37 additions and 5 deletions
|
@ -54,7 +54,7 @@ if [[ $use_sudo -eq 1 ]]; then
|
||||||
|
|
||||||
# apt-get only
|
# apt-get only
|
||||||
alias ads="sudo $apt_pref dselect-upgrade"
|
alias ads="sudo $apt_pref dselect-upgrade"
|
||||||
|
|
||||||
# Install all .deb files in the current directory.
|
# Install all .deb files in the current directory.
|
||||||
# Warning: you will need to put the glob in single quotes if you use:
|
# Warning: you will need to put the glob in single quotes if you use:
|
||||||
# glob_subst
|
# glob_subst
|
||||||
|
@ -113,9 +113,6 @@ alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
|
||||||
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Functions #################################################################
|
# Functions #################################################################
|
||||||
# create a simple script that can be used to 'duplicate' a system
|
# create a simple script that can be used to 'duplicate' a system
|
||||||
apt-copy() {
|
apt-copy() {
|
||||||
|
@ -132,11 +129,46 @@ apt-copy() {
|
||||||
chmod +x apt-copy.sh
|
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
|
# Kernel-package building shortcut
|
||||||
kerndeb () {
|
kerndeb () {
|
||||||
# temporarily unset MAKEFLAGS ( '-j3' will fail )
|
# 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'"
|
print '$MAKEFLAGS set to '"'$MAKEFLAGS'"
|
||||||
appendage='-custom' # this shows up in $ (uname -r )
|
appendage='-custom' # this shows up in $ (uname -r )
|
||||||
revision=$(date +"%Y%m%d") # this shows up in the .deb file name
|
revision=$(date +"%Y%m%d") # this shows up in the .deb file name
|
||||||
|
|
Loading…
Reference in a new issue