1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-23 14:20:08 +00:00

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.
This commit is contained in:
mnv 2024-10-26 16:43:53 +05:30 committed by GitHub
parent 6a5e4c3801
commit 7c85120799
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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