1
0
Fork 0
mirror of synced 2024-11-22 10:05:37 -05:00
garuda-common-settings/usr/bin/update
2021-07-05 07:19:57 +02:00

27 lines
1,021 B
Bash
Executable file

#!/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
echo ""
# Check for keyring update & update as needed
echo "Checking for keyring update, then update as needed.."
if pacman -Qq blackarch-keyring &> /dev/null; then
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 ""
# Update mlocate index
pacman -Qq mlocate > /dev/null && echo "Updating mlocate index.." && sudo updatedb
echo "System updated!"