Files
custum-hyprpanel/scripts/checkUpdates.sh
Cameron Smith 0156d2d8c1 Add support for dnf and fedora in checkUpdates.sh (#249)
* Add support for dnf and fedora in checkUpdates.sh

* commit changes to updates + bar

* Remove antiquated padding shenanigan <3

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>

---------

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
2024-09-11 02:57:05 -07:00

32 lines
539 B
Bash
Executable File

#!/bin/bash
check_arch_updates() {
result=$(yay -Qum --noconfirm 2>/dev/null | wc -l || echo 0)
echo "$result"
}
check_ubuntu_updates() {
result=$(apt-get -s -o Debug::NoLocking=true upgrade | grep -c ^Inst)
echo "$result"
}
check_fedora_updates() {
result=$(dnf check-update -q | grep -v '^Loaded plugins' | grep -v '^No match for' | wc -l)
echo "$result"
}
case "$1" in
-arch)
check_arch_updates
;;
-ubuntu)
check_ubuntu_updates
;;
-fedora)
check_fedora_updates
;;
*)
echo "0"
;;
esac