dotfiles/.config/hypr/scripts/Distro_update.sh
2026-05-13 21:22:17 +02:00

45 lines
1.7 KiB
Bash
Executable file

#!/usr/bin/env bash
# ==================================================
# KoolDots (2026)
# Project URL: https://github.com/LinuxBeginnings
# License: GNU GPLv3
# SPDX-License-Identifier: GPL-3.0-or-later
# ==================================================
# Simple bash script to check and will try to update your system
# Local Paths
iDIR="$HOME/.config/swaync/images"
# Check for required tools (kitty)
if ! command -v kitty &> /dev/null; then
notify-send -i "$iDIR/error.png" "Need Kitty:" "Kitty terminal not found. Please install Kitty 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
kitty -T update -e paru -Syu
notify-send -i "$iDIR/ja.png" -u low 'Arch-based system' 'has been updated.'
else
kitty -T update -e yay -Syu
notify-send -i "$iDIR/ja.png" -u low 'Arch-based system' 'has been updated.'
fi
elif command -v dnf &> /dev/null; then
# Fedora-based
kitty -T update -e sudo dnf update --refresh -y
notify-send -i "$iDIR/ja.png" -u low 'Fedora system' 'has been updated.'
elif command -v apt &> /dev/null; then
# Debian-based (Debian, Ubuntu, etc.)
kitty -T update -e bash -c "sudo apt update && sudo apt upgrade -y"
notify-send -i "$iDIR/ja.png" -u low 'Debian/Ubuntu system' 'has been updated.'
elif command -v zypper &> /dev/null; then
# openSUSE-based
kitty -T update -e sudo zypper dup -y
notify-send -i "$iDIR/ja.png" -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