2021-06-26 14:00:10 -04:00
|
|
|
#!/bin/bash
|
2021-06-28 10:47:01 -04:00
|
|
|
# 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
|
|
|
|
|
2021-06-26 14:00:10 -04:00
|
|
|
# Refresh mirrorlist
|
2021-06-27 04:36:44 -04:00
|
|
|
echo "Refreshing mirrorlists.."
|
2021-06-26 14:00:10 -04:00
|
|
|
sudo reflector --latest 5 --age 2 --fastest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist
|
2021-06-27 04:36:44 -04:00
|
|
|
echo ""
|
2021-06-26 14:00:10 -04:00
|
|
|
|
|
|
|
# Check for keyring update & update as needed
|
2021-06-27 04:36:44 -04:00
|
|
|
echo "Checking for keyring update, then update as needed.."
|
2021-07-05 01:19:57 -04:00
|
|
|
if pacman -Qq blackarch-keyring &> /dev/null; then
|
2021-06-28 10:47:01 -04:00
|
|
|
sudo pacman -Sy archlinux-keyring blackarch-keyring chaotic-keyring --needed && $upd_cmd
|
|
|
|
else sudo pacman -Sy archlinux-keyring chaotic-keyring --needed && $upd_cmd
|
2021-07-02 05:03:30 -04:00
|
|
|
fi
|
2021-06-27 04:36:44 -04:00
|
|
|
echo ""
|
2021-06-26 14:00:10 -04:00
|
|
|
|
|
|
|
# Update mlocate index
|
2021-07-08 02:27:55 -04:00
|
|
|
if [ -x /usr/bin/locate ]; then
|
2021-07-08 02:26:31 -04:00
|
|
|
echo "Updating mlocate index.."
|
|
|
|
sudo updatedb
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Update fish completions
|
|
|
|
if [ -x /usr/bin/fish ]; then
|
|
|
|
fish -c fish_update_completions
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "System updated! 🐧"
|