From aab60a3b849ccf717e8d86a557bd1e51cd298091 Mon Sep 17 00:00:00 2001 From: q3aql Date: Sat, 9 Aug 2025 18:51:49 +0200 Subject: [PATCH] .config/nwg-wrapper/scripts/checkUpdates.sh --- .config/nwg-wrapper/scripts/checkUpdates.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/.config/nwg-wrapper/scripts/checkUpdates.sh b/.config/nwg-wrapper/scripts/checkUpdates.sh index ebc3404..c3644c8 100755 --- a/.config/nwg-wrapper/scripts/checkUpdates.sh +++ b/.config/nwg-wrapper/scripts/checkUpdates.sh @@ -1,14 +1,25 @@ #!/bin/bash +# Variables +listupdates_file=/tmp/listupdates +listupdates_show=/tmp/listupdates_show + +# listupdates file init +if [ ! -f ${listupdates_file} ] ; then + touch ${listupdates_file} + echo "0" > ${listupdates_file} +fi +if [ ! -f ${listupdates_show} ] ; then + touch ${listupdates_show} + echo "0" > ${listupdates_show} +fi + # Check updates on Arch Linux if [ -f /usr/bin/pacman ] ; then - num_packages=$(pacman -Qu | wc -l) - echo "${num_packages} " + echo "$(cat ${listupdates_show}) " # Check updates on Ubuntu/Debian/Devuan elif [ -f /usr/bin/apt ] ; then - num_packages=$(apt list --upgradable 2>/dev/null | grep -c ^) - num_packages=$(expr ${num_packages} - 1) - echo "${num_packages} " + echo "$(cat ${listupdates_show}) " # Disable for other distros else echo "0 "