-
-
Save brakenium/a5c6488ab74cfd7dccd89c9528782459 to your computer and use it in GitHub Desktop.
Arch and Debian update script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Write an if statement to check if paru, rate-mirrors, ua-drop-caches (alias), and paccache are installed | |
# Otherwise it should continue to the next if statement | |
# If the above are installed, then it should run the following: | |
# TMPFILE="$(mktemp)" | |
# sudo true | |
# rate-mirrors --save=$TMPFILE arch --max-delay=21600 \ | |
# && sudo mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup \ | |
# && sudo mv $TMPFILE /etc/pacman.d/mirrorlist \ | |
# && ua-drop-caches \ | |
# && paru | |
# If the above are not installed, then it should run the following: | |
# sudo nala fetch --auto -y | |
# sudo nala upgrade -y | |
# sudo nala autopurge -y | |
# sudo nala clean -y | |
if [ -x "$(command -v paru)" ] && [ -x "$(command -v rate-mirrors)" ] && [ -x "$(command -v paccache)" ]; then | |
echo "Detected necessary packages for Arch Linux system update." | |
TMPFILE="$(mktemp)" | |
sudo true | |
rate-mirrors --save=$TMPFILE arch --max-delay=21600 \ | |
&& sudo mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup \ | |
&& sudo mv $TMPFILE /etc/pacman.d/mirrorlist \ | |
&& sudo paccache -rk3; paru -Sc --aur --noconfirm \ | |
&& paru | |
elif [ -x "$(command -v nala)" ]; then | |
echo "Detected necessary packages for Debian system update." | |
sudo nala fetch --auto -y \ | |
&& sudo nala upgrade -y \ | |
&& sudo nala autopurge -y \ | |
&& sudo nala clean | |
else | |
echo "We can not handle the system upgrade for you, please install the necessary packages." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment