2015-12-15 00:12:17 -05:00
|
|
|
#
|
2015-12-20 20:41:54 -05:00
|
|
|
# Pacman aliases
|
|
|
|
#
|
|
|
|
|
|
|
|
# ${zpacman_frontend} is provided by either .zimrc or (if not set) init.zsh
|
|
|
|
# The zpacman_frontend is _only_ used for package installs.
|
|
|
|
|
|
|
|
#
|
|
|
|
# Setup
|
2015-12-15 00:12:17 -05:00
|
|
|
#
|
|
|
|
|
|
|
|
# ensure pacman is available
|
2015-12-19 09:48:29 -05:00
|
|
|
if (( ! ${+commands[pacman]} )); then
|
2015-12-15 00:12:17 -05:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2016-02-06 15:17:37 -05:00
|
|
|
local zpacman_frontend_priv helper
|
|
|
|
|
2015-12-29 14:14:13 -05:00
|
|
|
if (( ! ${+zpacman_frontend} )); then
|
2015-12-15 23:09:36 -05:00
|
|
|
zpacman_frontend='pacman'
|
2016-02-06 15:17:37 -05:00
|
|
|
zpacman_frontend_priv='sudo pacman'
|
2015-12-19 09:48:29 -05:00
|
|
|
elif (( ! ${+commands[${zpacman_frontend}]} )); then
|
2015-12-29 14:14:13 -05:00
|
|
|
print "pacman frontend \"${zpacman_frontend}\" is invalid or not installed. Reverting to \"pacman\".
|
2016-02-06 15:17:37 -05:00
|
|
|
You can fix this error by editing the 'zpacman_frontend' variable in your .zimrc" >&2
|
2015-12-15 00:12:17 -05:00
|
|
|
zpacman_frontend='pacman'
|
2016-02-06 15:17:37 -05:00
|
|
|
zpacman_frontend_priv='sudo pacman'
|
2016-03-10 12:42:35 -05:00
|
|
|
elif [[ ${zpacman_frontend} == ("yaourt"|"pacaur") ]]; then
|
|
|
|
# yaourt and pacaur handles SUID themselves
|
2016-02-06 15:17:37 -05:00
|
|
|
zpacman_frontend_priv="${zpacman_frontend}"
|
|
|
|
else
|
|
|
|
zpacman_frontend_priv="sudo ${zpacman_frontend}"
|
2015-12-15 00:12:17 -05:00
|
|
|
fi
|
|
|
|
|
2016-02-05 21:32:31 -05:00
|
|
|
|
2015-12-20 20:41:54 -05:00
|
|
|
#
|
|
|
|
# General
|
|
|
|
#
|
|
|
|
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pac=${zpacman_frontend}
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build
|
|
|
|
#
|
|
|
|
|
|
|
|
# build package in current directory, cleanup, and install
|
|
|
|
alias pacb='makepkg -sci'
|
|
|
|
|
|
|
|
#
|
|
|
|
# Install
|
|
|
|
#
|
|
|
|
|
|
|
|
#NOTE: Installing/upgrading individual packages is NOT supported. Sync and upgrade ALL on install.
|
|
|
|
|
|
|
|
# install, sync, and upgrade packages
|
2016-02-06 15:17:37 -05:00
|
|
|
alias paci="${zpacman_frontend_priv} -Syu"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# install, sync, and upgrade packages (forcibly refresh package lists)
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacu="${zpacman_frontend_priv} -Syyu"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# install packages by filename
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacU="${zpacman_frontend_priv} -U"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# install all packages in current directory
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacd="${zpacman_frontend_priv} -U *.pkg.tar.xz"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Remove
|
|
|
|
#
|
|
|
|
|
|
|
|
# remove package and unneeded dependencies
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacr="${zpacman_frontend_priv} -R"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# remove package, unneeded dependencies, and configuration files
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacrm="${zpacman_frontend_priv} -Rns"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Query
|
|
|
|
#
|
|
|
|
|
|
|
|
# query package information from the remote repository
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacq="${zpacman_frontend} -Si"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# query package information from the local repository
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacQ="${zpacman_frontend} -Qi"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Search
|
|
|
|
#
|
|
|
|
|
|
|
|
# search for package in the remote repository
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacs="${zpacman_frontend} -Ss"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# search for the package in the local repository
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacS="${zpacman_frontend} -Qs"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Orphans
|
|
|
|
#
|
|
|
|
|
|
|
|
# list orphan packages
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacol="${zpacman_frontend} -Qdt"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# remove orphan packages
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacor="${zpacman_frontend_priv} -Rns $(pacman -Qtdq)"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Ownership
|
|
|
|
#
|
|
|
|
|
|
|
|
# list all files that belong to a package
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacown="${zpacman_frontend} -Ql"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
# show package(s) owning the specified file
|
2016-02-06 15:17:37 -05:00
|
|
|
alias pacblame="${zpacman_frontend} -Qo"
|
2015-12-20 20:41:54 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Helpers
|
|
|
|
#
|
|
|
|
|
2015-12-15 00:12:17 -05:00
|
|
|
# source helper functions/aliases
|
|
|
|
for helper ( ${zpacman_helper[@]} ); do
|
|
|
|
if [[ -s ${0:h}/helper_${helper}.zsh ]]; then
|
|
|
|
source ${0:h}/helper_${helper}.zsh
|
|
|
|
else
|
|
|
|
print "no such helper script \"helper_${helper}.zsh\"" >&2
|
|
|
|
fi
|
|
|
|
done
|