2021-04-06 03:28:22 -07:00
|
|
|
#######################################
|
|
|
|
# Pacman #
|
|
|
|
#######################################
|
2018-04-15 05:47:08 -07:00
|
|
|
|
2021-04-06 03:28:22 -07:00
|
|
|
# abs and aur command check
|
|
|
|
local abs_aur=''
|
|
|
|
(( ! $+commands[abs] )) || abs_aur+=' && sudo abs'
|
|
|
|
(( ! $+commands[aur] )) || abs_aur+=' && sudo aur'
|
2018-04-15 05:47:08 -07:00
|
|
|
|
2016-09-26 23:17:18 -07:00
|
|
|
|
2011-07-16 15:42:09 -07:00
|
|
|
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
2016-08-23 23:08:55 -07:00
|
|
|
alias pacupg='sudo pacman -Syu'
|
|
|
|
alias pacin='sudo pacman -S'
|
|
|
|
alias pacins='sudo pacman -U'
|
|
|
|
alias pacre='sudo pacman -R'
|
|
|
|
alias pacrem='sudo pacman -Rns'
|
|
|
|
alias pacrep='pacman -Si'
|
|
|
|
alias pacreps='pacman -Ss'
|
|
|
|
alias pacloc='pacman -Qi'
|
|
|
|
alias paclocs='pacman -Qs'
|
|
|
|
alias pacinsd='sudo pacman -S --asdeps'
|
|
|
|
alias pacmir='sudo pacman -Syy'
|
|
|
|
alias paclsorphans='sudo pacman -Qdt'
|
|
|
|
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
2017-02-23 00:52:56 -07:00
|
|
|
alias pacfileupg='sudo pacman -Fy'
|
2020-03-10 04:29:43 -07:00
|
|
|
alias pacfiles='pacman -F'
|
2018-04-15 10:13:39 -07:00
|
|
|
alias pacls='pacman -Ql'
|
|
|
|
alias pacown='pacman -Qo'
|
2021-04-06 03:28:22 -07:00
|
|
|
alias pacupd="sudo pacman -Sy$abs_aur"
|
|
|
|
alias upgrade='sudo pacman -Syu'
|
2011-07-16 15:42:09 -07:00
|
|
|
|
2018-04-15 06:53:43 -07:00
|
|
|
function paclist() {
|
2021-04-06 03:28:22 -07:00
|
|
|
# Based on https://bbs.archlinux.org/viewtopic.php?id=93683
|
|
|
|
pacman -Qqe | \
|
|
|
|
xargs -I '{}' \
|
|
|
|
expac "${bold_color}% 20n ${fg_no_bold[white]}%d${reset_color}" '{}'
|
2011-07-16 15:42:09 -07:00
|
|
|
}
|
2011-07-19 19:38:29 -07:00
|
|
|
|
2018-04-15 06:53:43 -07:00
|
|
|
function pacdisowned() {
|
2020-12-07 14:00:25 -07:00
|
|
|
local tmp db fs
|
2011-07-16 15:42:09 -07:00
|
|
|
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
|
|
|
db=$tmp/db
|
|
|
|
fs=$tmp/fs
|
|
|
|
|
|
|
|
mkdir "$tmp"
|
2020-12-07 14:00:25 -07:00
|
|
|
trap 'rm -rf "$tmp"' EXIT
|
2011-07-16 15:42:09 -07:00
|
|
|
|
|
|
|
pacman -Qlq | sort -u > "$db"
|
|
|
|
|
2016-08-23 23:08:55 -07:00
|
|
|
find /bin /etc /lib /sbin /usr ! -name lost+found \
|
|
|
|
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
2011-07-16 15:42:09 -07:00
|
|
|
|
|
|
|
comm -23 "$fs" "$db"
|
|
|
|
}
|
2012-12-02 12:55:19 -07:00
|
|
|
|
2021-04-06 03:28:22 -07:00
|
|
|
alias pacmanallkeys='sudo pacman-key --refresh-keys'
|
2012-12-02 12:55:19 -07:00
|
|
|
|
2018-04-15 06:53:43 -07:00
|
|
|
function pacmansignkeys() {
|
2020-12-07 14:00:25 -07:00
|
|
|
local key
|
|
|
|
for key in $@; do
|
2012-12-02 12:55:19 -07:00
|
|
|
sudo pacman-key --recv-keys $key
|
|
|
|
sudo pacman-key --lsign-key $key
|
|
|
|
printf 'trust\n3\n' | sudo gpg --homedir /etc/pacman.d/gnupg \
|
|
|
|
--no-permission-warning --command-fd 0 --edit-key $key
|
|
|
|
done
|
|
|
|
}
|
2018-04-15 10:13:39 -07:00
|
|
|
|
|
|
|
if (( $+commands[xdg-open] )); then
|
|
|
|
function pacweb() {
|
2021-04-06 03:28:22 -07:00
|
|
|
if [[ $# = 0 || "$1" =~ '--help|-h' ]]; then
|
|
|
|
local underline_color="\e[${color[underline]}m"
|
|
|
|
echo "$0 - open the website of an ArchLinux package"
|
|
|
|
echo
|
|
|
|
echo "Usage:"
|
|
|
|
echo " $bold_color$0$reset_color ${underline_color}target${reset_color}"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2020-12-07 14:00:25 -07:00
|
|
|
local pkg="$1"
|
|
|
|
local infos="$(LANG=C pacman -Si "$pkg")"
|
2018-04-15 10:13:39 -07:00
|
|
|
if [[ -z "$infos" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
2020-12-07 14:00:25 -07:00
|
|
|
local repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
|
|
|
|
local arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
|
2018-04-15 10:13:39 -07:00
|
|
|
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
|
|
|
|
}
|
|
|
|
fi
|
2021-04-06 03:28:22 -07:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
# AUR helpers #
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
if (( $+commands[pacaur] )); then
|
|
|
|
alias paupg='pacaur -Syu'
|
|
|
|
alias pasu='pacaur -Syu --noconfirm'
|
|
|
|
alias pain='pacaur -S'
|
|
|
|
alias pains='pacaur -U'
|
|
|
|
alias pare='pacaur -R'
|
|
|
|
alias parem='pacaur -Rns'
|
|
|
|
alias parep='pacaur -Si'
|
|
|
|
alias pareps='pacaur -Ss'
|
|
|
|
alias paloc='pacaur -Qi'
|
|
|
|
alias palocs='pacaur -Qs'
|
|
|
|
alias palst='pacaur -Qe'
|
|
|
|
alias paorph='pacaur -Qtd'
|
|
|
|
alias painsd='pacaur -S --asdeps'
|
|
|
|
alias pamir='pacaur -Syy'
|
|
|
|
alias paupd="pacaur -Sy$abs_aur"
|
|
|
|
alias upgrade='pacaur -Syu'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if (( $+commands[trizen] )); then
|
|
|
|
alias trconf='trizen -C'
|
|
|
|
alias trupg='trizen -Syua'
|
|
|
|
alias trsu='trizen -Syua --noconfirm'
|
|
|
|
alias trin='trizen -S'
|
|
|
|
alias trins='trizen -U'
|
|
|
|
alias trre='trizen -R'
|
|
|
|
alias trrem='trizen -Rns'
|
|
|
|
alias trrep='trizen -Si'
|
|
|
|
alias trreps='trizen -Ss'
|
|
|
|
alias trloc='trizen -Qi'
|
|
|
|
alias trlocs='trizen -Qs'
|
|
|
|
alias trlst='trizen -Qe'
|
|
|
|
alias trorph='trizen -Qtd'
|
|
|
|
alias trinsd='trizen -S --asdeps'
|
|
|
|
alias trmir='trizen -Syy'
|
|
|
|
alias trupd="trizen -Sy$abs_aur"
|
|
|
|
alias upgrade='trizen -Syu'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if (( $+commands[yaourt] )); then
|
|
|
|
alias yaconf='yaourt -C'
|
|
|
|
alias yaupg='yaourt -Syua'
|
|
|
|
alias yasu='yaourt -Syua --noconfirm'
|
|
|
|
alias yain='yaourt -S'
|
|
|
|
alias yains='yaourt -U'
|
|
|
|
alias yare='yaourt -R'
|
|
|
|
alias yarem='yaourt -Rns'
|
|
|
|
alias yarep='yaourt -Si'
|
|
|
|
alias yareps='yaourt -Ss'
|
|
|
|
alias yaloc='yaourt -Qi'
|
|
|
|
alias yalocs='yaourt -Qs'
|
|
|
|
alias yalst='yaourt -Qe'
|
|
|
|
alias yaorph='yaourt -Qtd'
|
|
|
|
alias yainsd='yaourt -S --asdeps'
|
|
|
|
alias yamir='yaourt -Syy'
|
|
|
|
alias yaupd="yaourt -Sy$abs_aur"
|
|
|
|
alias upgrade='yaourt -Syu'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if (( $+commands[yay] )); then
|
|
|
|
alias yaconf='yay -Pg'
|
|
|
|
alias yaupg='yay -Syu'
|
|
|
|
alias yasu='yay -Syu --noconfirm'
|
|
|
|
alias yain='yay -S'
|
|
|
|
alias yains='yay -U'
|
|
|
|
alias yare='yay -R'
|
|
|
|
alias yarem='yay -Rns'
|
|
|
|
alias yarep='yay -Si'
|
|
|
|
alias yareps='yay -Ss'
|
|
|
|
alias yaloc='yay -Qi'
|
|
|
|
alias yalocs='yay -Qs'
|
|
|
|
alias yalst='yay -Qe'
|
|
|
|
alias yaorph='yay -Qtd'
|
|
|
|
alias yainsd='yay -S --asdeps'
|
|
|
|
alias yamir='yay -Syy'
|
|
|
|
alias yaupd="yay -Sy$abs_aur"
|
|
|
|
alias upgrade='yay -Syu'
|
|
|
|
fi
|
|
|
|
|
|
|
|
unset abs_aur
|