From 34ae9560c51f1394f6b19b88dcf7a37cb6bc1365 Mon Sep 17 00:00:00 2001 From: dr460nf1r3 Date: Mon, 28 Jun 2021 16:47:01 +0200 Subject: [PATCH] Detect what application is going to update the system --- usr/bin/update | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/usr/bin/update b/usr/bin/update index 46e8b92..ff74c10 100755 --- a/usr/bin/update +++ b/usr/bin/update @@ -1,4 +1,14 @@ #!/bin/bash +# Check for AUR helper +if [ -x /usr/bin/paru ]; then + upd_cmd="paru -Su" + echo "Detected Paru, using it to update the system.." +elif [ -x /usr/bin/yay ]; then + upd_cmd="yay -Su" + echo "Detected Yay, using it to update the system.." +else upd_cmd="sudo pacman -Su" && echo "No AUR helper installed, using Pacman to update.." +fi + # Refresh mirrorlist echo "Refreshing mirrorlists.." sudo reflector --latest 5 --age 2 --fastest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist @@ -7,8 +17,8 @@ echo "" # Check for keyring update & update as needed echo "Checking for keyring update, then update as needed.." if pacman -Qs blackarch-keyring; then - sudo pacman -Sy archlinux-keyring blackarch-keyring chaotic-keyring --needed && paru -Su -else sudo pacman -Sy archlinux-keyring chaotic-keyring --needed && paru -Su + sudo pacman -Sy archlinux-keyring blackarch-keyring chaotic-keyring --needed && $upd_cmd +else sudo pacman -Sy archlinux-keyring chaotic-keyring --needed && $upd_cmd fi echo ""