Don't use sudo if the backend implicitly calls it
Also don't rely on alias expansion to handle the pacman, because aliases are not expanded in sudo.
This commit is contained in:
parent
2ebdbdcff5
commit
1caf786f49
2 changed files with 24 additions and 16 deletions
|
@ -20,6 +20,10 @@ fi
|
||||||
|
|
||||||
# Get the Pacman frontend.
|
# Get the Pacman frontend.
|
||||||
zstyle -s ':prezto:module:pacman' frontend '_pacman_frontend'
|
zstyle -s ':prezto:module:pacman' frontend '_pacman_frontend'
|
||||||
|
_pacman_sudo='sudo '
|
||||||
|
if zstyle -t ':prezto:module:pacman' no_sudo; then
|
||||||
|
_pacman_sudo=''
|
||||||
|
fi
|
||||||
|
|
||||||
if (( $+commands[$_pacman_frontend] )); then
|
if (( $+commands[$_pacman_frontend] )); then
|
||||||
alias pacman="$_pacman_frontend"
|
alias pacman="$_pacman_frontend"
|
||||||
|
@ -34,49 +38,50 @@ fi
|
||||||
#
|
#
|
||||||
|
|
||||||
# Pacman.
|
# Pacman.
|
||||||
alias pac='pacman'
|
alias pac= "${_pacman_frontend}"
|
||||||
|
|
||||||
# Installs packages from repositories.
|
# Installs packages from repositories.
|
||||||
alias paci='sudo pacman --sync'
|
alias paci="${_pacman_sudo}${_pacman_frontend} --sync"
|
||||||
|
|
||||||
# Installs packages from files.
|
# Installs packages from files.
|
||||||
alias pacI='sudo pacman --upgrade'
|
alias pacI="${_pacman_sudo}${_pacman_frontend} --upgrade"
|
||||||
|
|
||||||
# Removes packages and unneeded dependencies.
|
# Removes packages and unneeded dependencies.
|
||||||
alias pacx='sudo pacman --remove'
|
alias pacx="${_pacman_sudo}${_pacman_frontend} --remove"
|
||||||
|
|
||||||
# Removes packages, their configuration, and unneeded dependencies.
|
# Removes packages, their configuration, and unneeded dependencies.
|
||||||
alias pacX='sudo pacman --remove --nosave --recursive'
|
alias pacX="${_pacman_sudo}${_pacman_frontend} --remove --nosave --recursive"
|
||||||
|
|
||||||
# Displays information about a package from the repositories.
|
# Displays information about a package from the repositories.
|
||||||
alias pacq='pacman --sync --info'
|
alias pacq="${_pacman_frontend} --sync --info"
|
||||||
|
|
||||||
# Displays information about a package from the local database.
|
# Displays information about a package from the local database.
|
||||||
alias pacQ='pacman --query --info'
|
alias pacQ="${_pacman_frontend} --query --info"
|
||||||
|
|
||||||
# Searches for packages in the repositories.
|
# Searches for packages in the repositories.
|
||||||
alias pacs='pacman --sync --search'
|
alias pacs="${_pacman_frontend} --sync --search"
|
||||||
|
|
||||||
# Searches for packages in the local database.
|
# Searches for packages in the local database.
|
||||||
alias pacS='pacman --query --search'
|
alias pacS="${_pacman_frontend} --query --search"
|
||||||
|
|
||||||
# Lists orphan packages.
|
# Lists orphan packages.
|
||||||
alias pacman-list-orphans='sudo pacman --query --deps --unrequired'
|
alias pacman-list-orphans="${_pacman_sudo}${_pacman_frontend} --query --deps --unrequired"
|
||||||
|
|
||||||
# Removes orphan packages.
|
# Removes orphan packages.
|
||||||
alias pacman-remove-orphans='sudo pacman --remove --recursive $(pacman --quiet --query --deps --unrequired)'
|
alias pacman-remove-orphans="${_pacman_sudo}${_pacman_frontend} --remove --recursive \$(${_pacman_frontend} --quiet --query --deps --unrequired)"
|
||||||
|
|
||||||
# Synchronizes the local package and Arch Build System databases against the
|
# Synchronizes the local package and Arch Build System databases against the
|
||||||
# repositories.
|
# repositories.
|
||||||
if (( $+commands[abs] )); then
|
if (( $+commands[abs] )); then
|
||||||
alias pacu='sudo pacman --sync --refresh && sudo abs'
|
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh && ${_pacman_sudo}abs"
|
||||||
else
|
else
|
||||||
alias pacu='sudo pacman --sync --refresh'
|
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Synchronizes the local package database against the repositories then
|
# Synchronizes the local package database against the repositories then
|
||||||
# upgrades outdated packages.
|
# upgrades outdated packages.
|
||||||
alias pacU='sudo pacman --sync --refresh --sysupgrade'
|
alias pacU="${_pacman_sudo}${_pacman_frontend} --sync --refresh --sysupgrade"
|
||||||
|
|
||||||
unset _pacman_frontend
|
unset _pacman_frontend
|
||||||
|
unset _pacman_sudo
|
||||||
|
|
||||||
|
|
|
@ -5,15 +5,18 @@
|
||||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Yaourt does not need sudo
|
||||||
|
_pacman_sudo=''
|
||||||
|
|
||||||
#
|
#
|
||||||
# Aliases
|
# Aliases
|
||||||
#
|
#
|
||||||
|
|
||||||
# Disable color.
|
# Disable color.
|
||||||
if ! zstyle -t ':prezto:module:pacman:yaourt' color; then
|
if ! zstyle -t ':prezto:module:pacman:yaourt' color; then
|
||||||
alias pacman='pacman --nocolor'
|
alias pacman='yaourt --nocolor'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Manages .pac* files.
|
# Manages .pac* files.
|
||||||
alias pacc='pacman -C'
|
alias pacc='yaourt -C'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue