.config/nwg-wrapper/scripts/checkUpdates.sh
This commit is contained in:
parent
b7a6105ede
commit
aab60a3b84
@ -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 "
|
||||
|
Loading…
x
Reference in New Issue
Block a user