1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-18 10:22:00 +00:00

feat(archlinux): unify upgrade function (#11597)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
deimosian 2023-04-07 11:43:45 +00:00 committed by GitHub
parent 01c82c381d
commit 9b1ef262bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,7 +23,6 @@ alias pacfiles='pacman -F'
alias pacls='pacman -Ql'
alias pacown='pacman -Qo'
alias pacupd="sudo pacman -Sy"
alias upgrade='sudo pacman -Syu'
function paclist() {
# Based on https://bbs.archlinux.org/viewtopic.php?id=93683
@ -109,7 +108,6 @@ if (( $+commands[aura] )); then
alias auupd="sudo aura -Sy"
alias auupg='sudo sh -c "aura -Syu && aura -Au"'
alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"'
alias upgrade='sudo aura -Syu'
# extra bonus specially for aura
alias auown="aura -Qqo"
@ -136,7 +134,6 @@ if (( $+commands[pacaur] )); then
alias painsd='pacaur -S --asdeps'
alias pamir='pacaur -Syy'
alias paupd="pacaur -Sy"
alias upgrade='pacaur -Syu'
fi
if (( $+commands[trizen] )); then
@ -158,7 +155,6 @@ if (( $+commands[trizen] )); then
alias trinsd='trizen -S --asdeps'
alias trmir='trizen -Syy'
alias trupd="trizen -Sy"
alias upgrade='trizen -Syu'
fi
if (( $+commands[yay] )); then
@ -180,5 +176,30 @@ if (( $+commands[yay] )); then
alias yainsd='yay -S --asdeps'
alias yamir='yay -Syy'
alias yaupd="yay -Sy"
alias upgrade='yay -Syu'
fi
# Check Arch Linux PGP Keyring before System Upgrade to prevent failure.
function upgrade() {
echo "[oh-my-zsh] Checking Arch Linux PGP Keyring"
local installedver="$(sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')"
local currentver="$(sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')"
if [ $installedver != $currentver ]; then
echo "[oh-my-zsh] Arch Linux PGP Keyring is out of date."
echo "[oh-my-zsh] Updating before full system upgrade."
sudo pacman -Syu --needed --noconfirm archlinux-keyring
else
echo "[oh-my-zsh] Arch Linux PGP Keyring is up to date."
fi
echo "[oh-mh-zsh] Proceeding with full system upgrade."
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
}