Use 'apt' instead of 'apt-get' for Ubuntu >=16.04

This commit is contained in:
HaraldNordgren 2017-01-17 02:45:28 +01:00 committed by Harald Nordgren
parent c3b072eace
commit 6e61f3c583

View File

@ -8,15 +8,21 @@
# #
# Debian, Ubuntu and friends related zsh aliases and functions for zsh # Debian, Ubuntu and friends related zsh aliases and functions for zsh
if [[ -e $( which -p apt 2>&1 ) ]]; then
APT=apt
else
APT=apt-get
fi
alias acs='apt-cache search' alias acs='apt-cache search'
compdef _acs acs='apt-cache search' compdef _acs acs='apt-cache search'
alias afs='apt-file search --regexp' alias afs='apt-file search --regexp'
compdef _afs afs='apt-file search --regexp' compdef _afs afs='apt-file search --regexp'
# These are apt-get only # These are apt/apt-get only
alias ags='apt-get source' # asrc alias ags="$APT source" # asrc
compdef _ags ags='apt-get source' compdef _ags ags="$APT source"
alias acp='apt-cache policy' # app alias acp='apt-cache policy' # app
compdef _acp acp='apt-cache policy' compdef _acp acp='apt-cache policy'
@ -37,33 +43,33 @@ compdef _afu afu='sudo apt-file update'
alias ppap='sudo ppa-purge' alias ppap='sudo ppa-purge'
compdef _ppap ppap='sudo ppa-purge' compdef _ppap ppap='sudo ppa-purge'
alias apg='sudo apt-get' # age - but without sudo alias ag="sudo $APT" # age - but without sudo
alias aga='sudo apt-get autoclean' # aac alias aga="sudo $APT autoclean" # aac
alias agb='sudo apt-get build-dep' # abd alias agb="sudo $APT build-dep" # abd
alias agc='sudo apt-get clean' # adc alias agc="sudo $APT clean" # adc
alias agd='sudo apt-get dselect-upgrade' # ads alias agd="sudo $APT dselect-upgrade" # ads
alias agi='sudo apt-get install' # ai alias agi="sudo $APT install" # ai
alias agp='sudo apt-get purge' # ap alias agp="sudo $APT purge" # ap
alias agr='sudo apt-get remove' # ar alias agr="sudo $APT remove" # ar
alias agu='sudo apt-get update' # ad alias agu="sudo $APT update" # ad
alias agud='sudo apt-get update && sudo apt-get full-upgrade' #adu alias agud="sudo $APT update && sudo $APT dist-upgrade" #adu
alias agug='sudo apt-get upgrade' # ag alias agug="sudo $APT upgrade" # ag
alias aguu='sudo apt-get update && sudo apt-get upgrade' #adg alias aguu="sudo $APT update && sudo $APT upgrade" #adg
alias agar='sudo apt-get autoremove' alias agar="sudo $APT autoremove"
compdef _ag apg='sudo apt-get' compdef _ag ag="sudo $APT"
compdef _aga aga='sudo apt-get autoclean' compdef _aga aga="sudo $APT autoclean"
compdef _agb agb='sudo apt-get build-dep' compdef _agb agb="sudo $APT build-dep"
compdef _agc agc='sudo apt-get clean' compdef _agc agc="sudo $APT clean"
compdef _agd agd='sudo apt-get dselect-upgrade' compdef _agd agd="sudo $APT dselect-upgrade"
compdef _agi agi='sudo apt-get install' compdef _agi agi="sudo $APT install"
compdef _agp agp='sudo apt-get purge' compdef _agp agp="sudo $APT purge"
compdef _agr agr='sudo apt-get remove' compdef _agr agr="sudo $APT remove"
compdef _agu agu='sudo apt-get update' compdef _agu agu="sudo $APT update"
compdef _agud agud='sudo apt-get update && sudo apt-get full-upgrade' compdef _agud agud="sudo $APT update && sudo $APT dist-upgrade"
compdef _agug agug='sudo apt-get upgrade' compdef _agug agug="sudo $APT upgrade"
compdef _aguu aguu='sudo apt-get update && sudo apt-get upgrade' compdef _aguu aguu="sudo $APT update && sudo $APT upgrade"
compdef _agar agar='sudo apt-get autoremove' compdef _agar agar="sudo $APT autoremove"
# Remove ALL kernel images and headers EXCEPT the one in use # Remove ALL kernel images and headers EXCEPT the one in use
alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
@ -91,7 +97,7 @@ aar() {
PACKAGE=${1##*/} PACKAGE=${1##*/}
fi fi
sudo apt-add-repository $1 && sudo apt-get update sudo apt-add-repository $1 && sudo $APT update
sudo apt-get install $PACKAGE sudo apt-get install $PACKAGE
} }