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 "