2021-04-06 12:28:22 +02:00
|
|
|
#######################################
|
|
|
|
# Pacman #
|
|
|
|
#######################################
|
2018-04-15 14:47:08 +02:00
|
|
|
|
2011-07-17 00:42:09 +02:00
|
|
|
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
2016-08-24 08:08:55 +02:00
|
|
|
alias pacupg='sudo pacman -Syu'
|
|
|
|
alias pacin='sudo pacman -S'
|
2021-12-13 22:54:19 +01:00
|
|
|
alias paclean='sudo pacman -Sc'
|
2016-08-24 08:08:55 +02:00
|
|
|
alias pacins='sudo pacman -U'
|
2021-12-13 22:54:19 +01:00
|
|
|
alias paclr='sudo pacman -Scc'
|
2016-08-24 08:08:55 +02:00
|
|
|
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 08:52:56 +01:00
|
|
|
alias pacfileupg='sudo pacman -Fy'
|
2020-03-10 12:29:43 +01:00
|
|
|
alias pacfiles='pacman -F'
|
2018-04-15 19:13:39 +02:00
|
|
|
alias pacls='pacman -Ql'
|
|
|
|
alias pacown='pacman -Qo'
|
2021-04-09 20:48:24 +02:00
|
|
|
alias pacupd="sudo pacman -Sy"
|
2011-07-17 00:42:09 +02:00
|
|
|
|
2018-04-15 15:53:43 +02:00
|
|
|
function paclist() {
|
2023-06-19 12:32:37 +02:00
|
|
|
pacman -Qqe | xargs -I{} -P0 --no-run-if-empty pacman -Qs --color=auto "^{}\$"
|
2011-07-17 00:42:09 +02:00
|
|
|
}
|
2011-07-20 04:38:29 +02:00
|
|
|
|
2018-04-15 15:53:43 +02:00
|
|
|
function pacdisowned() {
|
2023-05-25 12:43:01 +02:00
|
|
|
local tmp_dir db fs
|
|
|
|
tmp_dir=$(mktemp --directory)
|
|
|
|
db=$tmp_dir/db
|
|
|
|
fs=$tmp_dir/fs
|
2011-07-17 00:42:09 +02:00
|
|
|
|
2023-05-25 12:43:01 +02:00
|
|
|
trap "rm -rf $tmp_dir" EXIT
|
2011-07-17 00:42:09 +02:00
|
|
|
|
|
|
|
pacman -Qlq | sort -u > "$db"
|
|
|
|
|
2023-05-25 12:43:01 +02:00
|
|
|
find /etc /usr ! -name lost+found \
|
2016-08-24 08:08:55 +02:00
|
|
|
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
2011-07-17 00:42:09 +02:00
|
|
|
|
|
|
|
comm -23 "$fs" "$db"
|
2023-05-25 12:43:01 +02:00
|
|
|
|
|
|
|
rm -rf $tmp_dir
|
2011-07-17 00:42:09 +02:00
|
|
|
}
|
2012-12-02 20:55:19 +01:00
|
|
|
|
2021-04-06 12:28:22 +02:00
|
|
|
alias pacmanallkeys='sudo pacman-key --refresh-keys'
|
2012-12-02 20:55:19 +01:00
|
|
|
|
2018-04-15 15:53:43 +02:00
|
|
|
function pacmansignkeys() {
|
2020-12-07 22:00:25 +01:00
|
|
|
local key
|
|
|
|
for key in $@; do
|
2012-12-02 20:55:19 +01: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 19:13:39 +02:00
|
|
|
|
|
|
|
if (( $+commands[xdg-open] )); then
|
|
|
|
function pacweb() {
|
2021-04-06 12:28:22 +02: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 22:00:25 +01:00
|
|
|
local pkg="$1"
|
|
|
|
local infos="$(LANG=C pacman -Si "$pkg")"
|
2018-04-15 19:13:39 +02:00
|
|
|
if [[ -z "$infos" ]]; then
|
|
|
|
return
|
|
|
|
fi
|
2020-12-07 22:00:25 +01:00
|
|
|
local repo="$(grep -m 1 '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
|
|
|
|
local arch="$(grep -m 1 '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
|
2018-04-15 19:13:39 +02:00
|
|
|
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
|
|
|
|
}
|
|
|
|
fi
|
2021-04-06 12:28:22 +02:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
# AUR helpers #
|
|
|
|
#######################################
|
|
|
|
|
2021-04-06 14:51:40 +02:00
|
|
|
if (( $+commands[aura] )); then
|
|
|
|
alias auin='sudo aura -S'
|
|
|
|
alias aurin='sudo aura -A'
|
2021-12-13 22:54:19 +01:00
|
|
|
alias auclean='sudo aura -Sc'
|
|
|
|
alias auclr='sudo aura -Scc'
|
2021-04-06 14:51:40 +02:00
|
|
|
alias auins='sudo aura -U'
|
|
|
|
alias auinsd='sudo aura -S --asdeps'
|
|
|
|
alias aurinsd='sudo aura -A --asdeps'
|
|
|
|
alias auloc='aura -Qi'
|
|
|
|
alias aulocs='aura -Qs'
|
|
|
|
alias aulst='aura -Qe'
|
|
|
|
alias aumir='sudo aura -Syy'
|
|
|
|
alias aurph='sudo aura -Oj'
|
|
|
|
alias aure='sudo aura -R'
|
|
|
|
alias aurem='sudo aura -Rns'
|
|
|
|
alias aurep='aura -Si'
|
|
|
|
alias aurrep='aura -Ai'
|
|
|
|
alias aureps='aura -As --both'
|
|
|
|
alias auras='aura -As --both'
|
2021-04-09 20:48:24 +02:00
|
|
|
alias auupd="sudo aura -Sy"
|
2021-04-06 14:51:40 +02:00
|
|
|
alias auupg='sudo sh -c "aura -Syu && aura -Au"'
|
2021-03-06 11:50:12 +01:00
|
|
|
alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"'
|
2021-04-06 14:51:40 +02:00
|
|
|
|
|
|
|
# extra bonus specially for aura
|
|
|
|
alias auown="aura -Qqo"
|
|
|
|
alias auls="aura -Qql"
|
|
|
|
function auownloc() { aura -Qi $(aura -Qqo $@); }
|
|
|
|
function auownls () { aura -Qql $(aura -Qqo $@); }
|
|
|
|
fi
|
|
|
|
|
2021-04-06 12:28:22 +02:00
|
|
|
if (( $+commands[pacaur] )); then
|
2021-12-13 22:54:19 +01:00
|
|
|
alias pacclean='pacaur -Sc'
|
|
|
|
alias pacclr='pacaur -Scc'
|
2021-04-06 12:28:22 +02:00
|
|
|
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'
|
2021-04-09 20:48:24 +02:00
|
|
|
alias paupd="pacaur -Sy"
|
2021-04-06 12:28:22 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if (( $+commands[trizen] )); then
|
|
|
|
alias trconf='trizen -C'
|
|
|
|
alias trupg='trizen -Syua'
|
|
|
|
alias trsu='trizen -Syua --noconfirm'
|
|
|
|
alias trin='trizen -S'
|
2021-12-13 22:54:19 +01:00
|
|
|
alias trclean='trizen -Sc'
|
|
|
|
alias trclr='trizen -Scc'
|
2021-04-06 12:28:22 +02:00
|
|
|
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'
|
2021-04-09 20:48:24 +02:00
|
|
|
alias trupd="trizen -Sy"
|
2021-04-06 12:28:22 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
if (( $+commands[yay] )); then
|
|
|
|
alias yaconf='yay -Pg'
|
2021-12-13 22:54:19 +01:00
|
|
|
alias yaclean='yay -Sc'
|
|
|
|
alias yaclr='yay -Scc'
|
2021-04-06 12:28:22 +02:00
|
|
|
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'
|
2021-04-09 20:48:24 +02:00
|
|
|
alias yaupd="yay -Sy"
|
2021-04-06 12:28:22 +02:00
|
|
|
fi
|
2023-04-07 13:43:45 +02:00
|
|
|
|
|
|
|
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
|
|
|
|
function upgrade() {
|
2023-04-09 12:58:38 +02:00
|
|
|
echo ":: Checking Arch Linux PGP Keyring..."
|
2024-04-04 10:08:28 +02:00
|
|
|
local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
|
|
|
local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
|
2023-04-07 13:43:45 +02:00
|
|
|
if [ $installedver != $currentver ]; then
|
2023-04-09 12:58:38 +02:00
|
|
|
echo " Arch Linux PGP Keyring is out of date."
|
|
|
|
echo " Updating before full system upgrade."
|
2023-04-09 10:24:55 +02:00
|
|
|
sudo pacman -Sy --needed --noconfirm archlinux-keyring
|
2023-04-07 13:43:45 +02:00
|
|
|
else
|
2023-04-09 12:58:38 +02:00
|
|
|
echo " Arch Linux PGP Keyring is up to date."
|
|
|
|
echo " Proceeding with full system upgrade."
|
2023-04-07 13:43:45 +02:00
|
|
|
fi
|
|
|
|
if (( $+commands[yay] )); then
|
|
|
|
yay -Syu
|
|
|
|
elif (( $+commands[trizen] )); then
|
|
|
|
trizen -Syu
|
|
|
|
elif (( $+commands[pacaur] )); then
|
|
|
|
pacaur -Syu
|
|
|
|
elif (( $+commands[aura] )); then
|
|
|
|
sudo aura -Syu
|
|
|
|
else
|
|
|
|
sudo pacman -Syu
|
|
|
|
fi
|
|
|
|
}
|