.config/nwg-wrapper/scripts/checkUpdates.sh
This commit is contained in:
parent
b7a6105ede
commit
aab60a3b84
@ -1,14 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/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
|
# Check updates on Arch Linux
|
||||||
if [ -f /usr/bin/pacman ] ; then
|
if [ -f /usr/bin/pacman ] ; then
|
||||||
num_packages=$(pacman -Qu | wc -l)
|
echo "$(cat ${listupdates_show}) "
|
||||||
echo "${num_packages} "
|
|
||||||
# Check updates on Ubuntu/Debian/Devuan
|
# Check updates on Ubuntu/Debian/Devuan
|
||||||
elif [ -f /usr/bin/apt ] ; then
|
elif [ -f /usr/bin/apt ] ; then
|
||||||
num_packages=$(apt list --upgradable 2>/dev/null | grep -c ^)
|
echo "$(cat ${listupdates_show}) "
|
||||||
num_packages=$(expr ${num_packages} - 1)
|
|
||||||
echo "${num_packages} "
|
|
||||||
# Disable for other distros
|
# Disable for other distros
|
||||||
else
|
else
|
||||||
echo "0 "
|
echo "0 "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user