+ pfile() {
+ if [[ $file == /* ]] && ucfq -w $file | grep -v ::: &>/dev/null; then
+ ucfq $file
+ elif [[ $file == */* ]]; then
+ apt-file find -x "$1"\$
+ else
+ apt-file find -x /"$1"\$
+ fi
+ }
+ pkgfiles() {
+ if dpkg -s "$1" &>/dev/null; then
+ dpkg-query -L $1
+ else
+ apt-file -x list "^$1$"
+ fi
+ }
+
+elif command -v pacman &>/dev/null; then
+ p() {
+ pacaur "$@"
+ }
+ pi() {
+ pacaur -S --noconfirm --needed --noedit "$@"
+ }
+ pf() {
+ pacaur -Ss "$@"
+ }
+ pu() {
+ pacaur -Rs --noconfirm "$@"
+ if p=$(pacaur -Qdtq); then
+ pacaur -Rs $p
+ fi
+ }
+ aurex() {
+ p="$1"
+ aur='https://aur.archlinux.org'
+ curl -s $aur/$(curl -s "$aur/rpc.php?type=info&arg=$p" \
+ | jq -r .results.URLPath) | tar xz
+ cd "$p"
+
+ }
+ pmirror() {
+ local s; [[ $EUID != 0 ]] && s=sudo
+ local x=$(mktemp)
+ curl -s "https://www.archlinux.org/mirrorlist/\
+?country=US&protocol=https&ip_version=4&ip_version=6&use_mirror_status=on" \
+ | sed -r 's/^[ #]*(Server *=)/\1/' > $x
+ if (( $(stat -c %s $x ) > 10 )); then
+ $s cp $x /etc/pacman.d/mirrorlist
+ rm $x
+ fi
+ }
+ pup() { # upgrade
+ local s; [[ $EUID != 0 ]] && s=sudo
+ # file_time + 24 hours > current_time
+ if ! (( $(stat -c%Y /etc/pacman.d/mirrorlist) + 60*60*24 > $(date +%s) ))
+ then
+ pmirror
+ fi
+ pacaur -Syu --noconfirm "$@"
+ }
+ # package info
+ pl() {
+ pacaur -Si "$@"
+ }
+ pfile() {
+ pkgfile "$1"
+ }
+ pkgfiles() {
+ if pacaur -Qs "^$1$" &>/dev/null; then
+ pacman -Ql $1
+ else
+ pkgfile -l $1
+ fi
+ }