f09bb8a7ac
The advantage of this is that the script can be updated remotely, allowing us to deal with new/emerging issues.
42 lines
1.3 KiB
Bash
Executable file
42 lines
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
if [ "$1" == "remote" ]; then
|
|
exec sudo bash -c "VERSION=1 . <(wget -qO- https://gitlab.com/garuda-linux/themes-and-settings/settings/garuda-common-settings/-/snippets/2147440/raw/main/remote-update) \"$2\""
|
|
fi
|
|
|
|
# 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
|
|
if [ -x /usr/bin/locate ]; then
|
|
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! 🐧"
|