Improvements to /usr/bin/updates
This commit is contained in:
parent
3008d02fee
commit
0f79f16200
1 changed files with 27 additions and 13 deletions
|
@ -1,4 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
# Run the "I'm too lazy to fix it myself all in one" script
|
# Run the "I'm too lazy to fix it myself all in one" script
|
||||||
if [ "$1" == "remote" ]; then
|
if [ "$1" == "remote" ]; then
|
||||||
echo "This will reset a lot of configurations to default ones - it is intended to be a oneclick fix for all kind of update issues. 🛑"
|
echo "This will reset a lot of configurations to default ones - it is intended to be a oneclick fix for all kind of update issues. 🛑"
|
||||||
|
@ -11,25 +13,33 @@ if [ "$1" == "remote" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for AUR helper
|
# Check for AUR helper
|
||||||
if [ -x /usr/bin/paru ]; then
|
if [ -x /usr/bin/paru ] && [[ $EUID -ne 0 ]]; then
|
||||||
upd_cmd="paru -Su"
|
upd_cmd="paru -Su"
|
||||||
echo "Detected Paru, using it to update the system.."
|
echo "Detected Paru, using it to update the system.."
|
||||||
elif [ -x /usr/bin/yay ]; then
|
elif [ -x /usr/bin/yay ] && [[ $EUID -ne 0 ]]; then
|
||||||
upd_cmd="yay -Su"
|
upd_cmd="yay -Su"
|
||||||
echo "Detected Yay, using it to update the system.."
|
echo "Detected Yay, using it to update the system.."
|
||||||
else upd_cmd="sudo pacman -Su" && echo "No AUR helper installed, using Pacman to update.."
|
else
|
||||||
|
upd_cmd="sudo pacman -Su"
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
echo "No AUR helper installed, using Pacman to update.."
|
||||||
|
else
|
||||||
|
echo "Executed as root, using Pacman to update.."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Refresh mirrorlist
|
if [ -x /usr/bin/reflector ]; then
|
||||||
echo "Refreshing mirrorlists.."
|
# Refresh mirrorlist
|
||||||
sudo reflector --latest 5 --age 2 --fastest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist
|
echo "Refreshing mirrorlists.."
|
||||||
echo ""
|
sudo reflector --latest 5 --age 2 --fastest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist && cat /etc/pacman.d/mirrorlist || false
|
||||||
|
fi
|
||||||
|
|
||||||
# Check for keyring update & update as needed
|
# Check for keyring update & update as needed
|
||||||
echo "Checking for keyring update, then update as needed.."
|
echo "Checking for keyring update before starting full system update.."
|
||||||
if pacman -Qq blackarch-keyring &> /dev/null; then
|
if pacman -Qq blackarch-keyring &> /dev/null; then
|
||||||
sudo pacman -Sy archlinux-keyring blackarch-keyring chaotic-keyring --needed && $upd_cmd
|
sudo pacman -Sy archlinux-keyring blackarch-keyring chaotic-keyring --needed && $upd_cmd || false
|
||||||
else sudo pacman -Sy archlinux-keyring chaotic-keyring --needed && $upd_cmd
|
else
|
||||||
|
sudo pacman -Sy archlinux-keyring chaotic-keyring --needed && $upd_cmd || false
|
||||||
fi
|
fi
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
@ -41,7 +51,11 @@ fi
|
||||||
|
|
||||||
# Update fish completions
|
# Update fish completions
|
||||||
if [ -x /usr/bin/fish ]; then
|
if [ -x /usr/bin/fish ]; then
|
||||||
fish -c fish_update_completions
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
fish -c fish_update_completions
|
||||||
|
elif [ ! -z "$SUDO_UID" ]; then
|
||||||
|
sudo -u \#$SUDO_UID fish -c fish_update_completions
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
Loading…
Reference in a new issue