Files
dotfiles/dotfiles/.config/waybar/scripts/update-distro.sh
2026-05-04 19:15:09 +01:00

41 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# HyprFlux — https://github.com/ahmad9059/HyprFlux
# Simple bash script to check and will try to update your system
# Local Paths
iDIR="$HOME/.config/swaync/images"
# Check for required tools (foot)
if ! command -v foot &> /dev/null; then
notify-send -i "$iDIR/error.png" "Need foot:" "foot terminal not found. Please install foot terminal."
exit 1
fi
# Detect distribution and update accordingly
if command -v paru &> /dev/null || command -v yay &> /dev/null; then
# Arch-based
if command -v paru &> /dev/null; then
foot -T update paru -Syu
notify-send -i "$iDIR/profile-pic.jpg" -u low 'Arch-based system' 'has been updated.'
else
foot -T update yay -Syu
notify-send -i "$iDIR/profile-pic.jpg" -u low 'Arch-based system' 'has been updated.'
fi
elif command -v dnf &> /dev/null; then
# Fedora-based
foot -T update sudo dnf update --refresh -y
notify-send -i "$iDIR/profile-pic.jpg" -u low 'Fedora system' 'has been updated.'
elif command -v apt &> /dev/null; then
# Debian-based (Debian, Ubuntu, etc.)
foot -T update sudo apt update && sudo apt upgrade -y
notify-send -i "$iDIR/profile-pic.jpg" -u low 'Debian/Ubuntu system' 'has been updated.'
elif command -v zypper &> /dev/null; then
# openSUSE-based
foot -T update sudo zypper dup -y
notify-send -i "$iDIR/profile-pic.jpg" -u low 'openSUSE system' 'has been updated.'
else
# Unsupported distro
notify-send -i "$iDIR/error.png" -u critical "Unsupported system" "This script does not support your distribution."
exit 1
fi