diff options
author | deimosian <deimosian@gmail.com> | 2023-04-07 11:43:45 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 13:43:45 +0200 |
commit | 9b1ef262bcc8d47a6d20b4efc673557560df6647 (patch) | |
tree | 907b610f7b74dee934bdb81fb606ef2a0c99de09 | |
parent | 01c82c381d90f10239908ace41df9532c8c45495 (diff) | |
download | zsh-9b1ef262bcc8d47a6d20b4efc673557560df6647.tar.gz zsh-9b1ef262bcc8d47a6d20b4efc673557560df6647.tar.bz2 zsh-9b1ef262bcc8d47a6d20b4efc673557560df6647.zip |
feat(archlinux): unify `upgrade` function (#11597)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
-rw-r--r-- | plugins/archlinux/archlinux.plugin.zsh | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index 4f1364779..e3b1b1261 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -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 +} |