From b9b2ea018c9724ab376ee3ef6f07086ce3f41811 Mon Sep 17 00:00:00 2001 From: TheyCallMeSecond <73380906+TheyCallMeSecond@users.noreply.github.com> Date: Sun, 15 Sep 2024 04:02:54 +0330 Subject: [PATCH] add official arch linux repo updatecheck to script for updates customModules (#254) * Update checkUpdates.sh add official repo update check * Update checkUpdates.sh separate pacman, aur and total updates check * Update scripts/checkUpdates.sh Co-authored-by: Jas Singh * Update scripts/checkUpdates.sh Co-authored-by: Jas Singh --------- Co-authored-by: Jas Singh --- scripts/checkUpdates.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/checkUpdates.sh b/scripts/checkUpdates.sh index 929023b..39bf6ec 100755 --- a/scripts/checkUpdates.sh +++ b/scripts/checkUpdates.sh @@ -1,8 +1,21 @@ #!/bin/bash check_arch_updates() { - result=$(yay -Qum --noconfirm 2>/dev/null | wc -l || echo 0) - echo "$result" + official_updates=0 + aur_updates=0 + + if [ "$1" = "-y" ]; then + aur_updates=$(yay -Qum 2>/dev/null | wc -l) + elif [ "$1" = "-p" ]; then + official_updates=$(checkupdates 2>/dev/null | wc -l) + else + official_updates=$(checkupdates 2>/dev/null | wc -l) + aur_updates=$(yay -Qum 2>/dev/null | wc -l) + fi + + total_updates=$((official_updates + aur_updates)) + + echo $total_updates } check_ubuntu_updates() { @@ -17,7 +30,7 @@ check_fedora_updates() { case "$1" in -arch) - check_arch_updates + check_arch_updates "$2" ;; -ubuntu) check_ubuntu_updates