Files
custum-hyprpanel/scripts/runUpdates.sh
Luiz Felipe Machado daf45665c4 fix(scripts): update flatpak only if command exists (#1000)
* fix(scripts): update flatpak only if command exists

Add a check to run flatpak update only when the flatpak command is
available, since Flatpak is not installed by default on Arch Linux,
preventing errors if flatpak is missing.

* Update scripts/runUpdates.sh

---------

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
2025-06-14 14:19:33 -07:00

66 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Provided by: https://github.com/JJDizz1L
install_arch_updates() {
echo "Updating Arch Linux system..."
sudo pacman -Syu
echo "Updating AUR packages..."
if command -v paru &> /dev/null; then
paru -Syu
elif command -v yay &> /dev/null; then
yay -Syu
else
echo "Missing AUR Helper. Try installing yay or paru"
fi
if command -v flatpak &> /dev/null; then
echo "Updating Flatpak packages..."
flatpak update -y
fi
echo "Done with Arch & AUR updates."
}
install_ubuntu_updates() {
echo "Updating Ubuntu system..."
sudo apt update && sudo apt upgrade -y
echo "Updating Flatpak packages..."
flatpak update -y
echo "Done with Ubuntu updates."
}
install_fedora_updates() {
echo "Updating Fedora system..."
sudo dnf update -y
echo "Updating Flatpak packages..."
flatpak update -y
echo "Done with Fedora updates."
}
install_flatpak_updates() {
echo "Updating Flatpak packages..."
flatpak update -y
echo "Done with FlatPak updates."
}
case "$1" in
-arch)
install_arch_updates
;;
-ubuntu)
install_ubuntu_updates
;;
-fedora)
install_fedora_updates
;;
-flatpak)
install_flatpak_updates
;;
*)
echo "Usage: $0 {-arch|-ubuntu|-fedora|-flatpak}"
;;
esac
echo "Press any key to exit..."
read -n 1