From 7c8512079995e51ae8447a4ac562172c1da54b38 Mon Sep 17 00:00:00 2001 From: mnv Date: Sat, 26 Oct 2024 16:43:53 +0530 Subject: [PATCH] fix: version comparison in Arch keyring upgrade check Replaces string comparison with proper version comparison using sort -V. This ensures correct handling of package versions like 1.2.3-1 vs 1.2.3-2. --- plugins/archlinux/archlinux.plugin.zsh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh index e20a31156..a4720a90f 100644 --- a/plugins/archlinux/archlinux.plugin.zsh +++ b/plugins/archlinux/archlinux.plugin.zsh @@ -181,7 +181,8 @@ function upgrade() { echo ":: Checking Arch Linux PGP Keyring..." local installedver="$(LANG= sudo pacman -Qi archlinux-keyring | grep -Po '(?<=Version : ).*')" local currentver="$(LANG= sudo pacman -Si archlinux-keyring | grep -Po '(?<=Version : ).*')" - if [ $installedver != $currentver ]; then + + if ! printf '%s\n' "$currentver" "$installedver" | sort -VC; then echo " Arch Linux PGP Keyring is out of date." echo " Updating before full system upgrade." sudo pacman -Sy --needed --noconfirm archlinux-keyring @@ -189,6 +190,7 @@ function upgrade() { echo " Arch Linux PGP Keyring is up to date." echo " Proceeding with full system upgrade." fi + if (( $+commands[yay] )); then yay -Syu elif (( $+commands[trizen] )); then