2011-08-31 11:16:15 +08:00
|
|
|
#
|
2012-07-01 05:29:30 +08:00
|
|
|
# Defines Pacman aliases.
|
2012-02-01 12:37:51 +08:00
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Benjamin Boudreau <dreurmail@gmail.com>
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
# Tips:
|
2011-08-31 11:16:15 +08:00
|
|
|
# https://wiki.archlinux.org/index.php/Pacman_Tips
|
2012-02-01 12:37:51 +08:00
|
|
|
#
|
2011-08-31 11:16:15 +08:00
|
|
|
|
2012-07-24 03:00:44 +08:00
|
|
|
# Return if requirements are not found.
|
|
|
|
if (( ! $+commands[pacman] )); then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2012-08-05 02:48:32 +08:00
|
|
|
#
|
|
|
|
# Frontend
|
|
|
|
#
|
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Get the Pacman frontend.
|
2012-09-04 04:08:39 +08:00
|
|
|
zstyle -s ':prezto:module:pacman' frontend '_pacman_frontend'
|
2011-10-12 11:13:58 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
if (( $+commands[$_pacman_frontend] )); then
|
|
|
|
alias pacman="$_pacman_frontend"
|
2013-12-09 22:29:14 +08:00
|
|
|
else
|
2014-01-22 11:12:09 +08:00
|
|
|
_pacman_frontend='pacman'
|
2013-12-09 22:29:14 +08:00
|
|
|
_pacman_sudo='sudo '
|
2011-08-31 11:16:15 +08:00
|
|
|
fi
|
|
|
|
|
2012-08-05 02:48:32 +08:00
|
|
|
#
|
2012-07-04 01:58:32 +08:00
|
|
|
# Aliases
|
2012-08-05 02:48:32 +08:00
|
|
|
#
|
2012-07-04 01:58:32 +08:00
|
|
|
|
2012-08-15 19:59:25 +08:00
|
|
|
# Pacman.
|
2014-01-13 17:45:08 +08:00
|
|
|
alias pac="${_pacman_frontend}"
|
2012-08-15 19:59:25 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Installs packages from repositories.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias paci="${_pacman_sudo}${_pacman_frontend} --sync"
|
2011-10-12 11:13:58 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Installs packages from files.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacI="${_pacman_sudo}${_pacman_frontend} --upgrade"
|
2011-10-12 11:13:58 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Removes packages and unneeded dependencies.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacx="${_pacman_sudo}${_pacman_frontend} --remove"
|
2011-10-12 11:13:58 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Removes packages, their configuration, and unneeded dependencies.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacX="${_pacman_sudo}${_pacman_frontend} --remove --nosave --recursive"
|
2011-10-12 11:13:58 +08:00
|
|
|
|
2012-07-04 01:58:32 +08:00
|
|
|
# Displays information about a package from the repositories.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacq="${_pacman_frontend} --sync --info"
|
2011-10-12 11:13:58 +08:00
|
|
|
|
2012-07-04 01:58:32 +08:00
|
|
|
# Displays information about a package from the local database.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacQ="${_pacman_frontend} --query --info"
|
2011-08-31 11:16:15 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Searches for packages in the repositories.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacs="${_pacman_frontend} --sync --search"
|
2011-08-31 11:16:15 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Searches for packages in the local database.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacS="${_pacman_frontend} --query --search"
|
2011-08-31 11:16:15 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Lists orphan packages.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacman-list-orphans="${_pacman_sudo}${_pacman_frontend} --query --deps --unrequired"
|
2011-08-31 11:16:15 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Removes orphan packages.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacman-remove-orphans="${_pacman_sudo}${_pacman_frontend} --remove --recursive \$(${_pacman_frontend} --quiet --query --deps --unrequired)"
|
2011-08-31 11:16:15 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Synchronizes the local package and Arch Build System databases against the
|
2017-06-09 01:18:37 +08:00
|
|
|
# repositories using the asp tool.
|
|
|
|
if (( $+commands[asp] )); then
|
|
|
|
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh && sudo asp update"
|
2011-10-12 11:13:58 +08:00
|
|
|
else
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacu="${_pacman_sudo}${_pacman_frontend} --sync --refresh"
|
2011-10-12 11:13:58 +08:00
|
|
|
fi
|
2011-08-31 11:16:15 +08:00
|
|
|
|
2012-07-01 05:29:30 +08:00
|
|
|
# Synchronizes the local package database against the repositories then
|
|
|
|
# upgrades outdated packages.
|
2013-12-09 22:29:14 +08:00
|
|
|
alias pacU="${_pacman_sudo}${_pacman_frontend} --sync --refresh --sysupgrade"
|
2012-07-01 05:29:30 +08:00
|
|
|
|
2018-01-25 05:47:20 +08:00
|
|
|
function aurget {
|
|
|
|
local target_dir="$1"
|
|
|
|
if [[ -n "$2" ]]; then
|
|
|
|
target_dir="$2"
|
|
|
|
fi
|
|
|
|
git clone "https://aur.archlinux.org/$1" "$target_dir"
|
|
|
|
}
|
|
|
|
|
2013-12-09 22:29:14 +08:00
|
|
|
unset _pacman_{frontend,sudo}
|