Compare commits
No commits in common. "aab60a3b849ccf717e8d86a557bd1e51cd298091" and "6e0eee66f9bbb11f3cb81e511ae29a5a0f32f219" have entirely different histories.
aab60a3b84
...
6e0eee66f9
@ -1,25 +1,14 @@
|
|||||||
#!/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
|
||||||
echo "$(cat ${listupdates_show}) "
|
num_packages=$(pacman -Qu | wc -l)
|
||||||
|
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
|
||||||
echo "$(cat ${listupdates_show}) "
|
num_packages=$(apt list --upgradable 2>/dev/null | grep -c ^)
|
||||||
|
num_packages=$(expr ${num_packages} - 1)
|
||||||
|
echo "${num_packages} "
|
||||||
# Disable for other distros
|
# Disable for other distros
|
||||||
else
|
else
|
||||||
echo "0 "
|
echo "0 "
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
# Variables
|
# Variables
|
||||||
checkupdates_file=/tmp/checkupdates
|
checkupdates_file=/tmp/checkupdates
|
||||||
checkupdates_run="7200" # 2 hours
|
checkupdates_run="7200" # 2 hours
|
||||||
listupdates_file=/tmp/listupdates
|
|
||||||
listupdates_run="60" # 1 minute
|
|
||||||
listupdates_show=/tmp/listupdates_show
|
|
||||||
|
|
||||||
# checkupdates file init
|
# checkupdates file init
|
||||||
if [ ! -f ${checkupdates_file} ] ; then
|
if [ ! -f ${checkupdates_file} ] ; then
|
||||||
@ -13,49 +10,28 @@ if [ ! -f ${checkupdates_file} ] ; then
|
|||||||
echo "0" > ${checkupdates_file}
|
echo "0" > ${checkupdates_file}
|
||||||
else
|
else
|
||||||
checkupdates_value=$(cat ${checkupdates_file})
|
checkupdates_value=$(cat ${checkupdates_file})
|
||||||
checkupdates_incr=$(( ${checkupdates_value} + 1))
|
checkupdates_incr=$(expr ${checkupdates_value} + 1)
|
||||||
echo "${checkupdates_incr}" > ${checkupdates_file}
|
echo "${checkupdates_incr}" > ${checkupdates_file}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# listupdates file init
|
|
||||||
if [ ! -f ${listupdates_file} ] ; then
|
|
||||||
touch ${listupdates_file}
|
|
||||||
echo "0" > ${listupdates_file}
|
|
||||||
else
|
|
||||||
listupdates_value=$(cat ${listupdates_file})
|
|
||||||
listupdates_incr=$((${listupdates_value} + 1))
|
|
||||||
echo "${listupdates_incr}" > ${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
|
||||||
checkupdate=$(cat ${checkupdates_file})
|
checkupdate=$(cat ${checkupdates_file})
|
||||||
listupdate=$(cat ${listupdates_file})
|
|
||||||
if [ -f /usr/bin/pacman ] ; then
|
if [ -f /usr/bin/pacman ] ; then
|
||||||
if [ ${checkupdate} -ge ${checkupdates_run} ] ; then
|
if [ ${checkupdate} -ge ${checkupdates_run} ] ; then
|
||||||
sudo -A pacman -Syy > /dev/null 2>&1
|
sudo -A pacman -Syy > /dev/null 2>&1
|
||||||
echo "0" > ${checkupdates_file}
|
echo "0" > ${checkupdates_file}
|
||||||
fi
|
fi
|
||||||
if [ ${listupdate} -ge ${listupdates_run} ] ; then
|
num_packages=$(pacman -Qu | wc -l)
|
||||||
num_packages=$(pacman -Qu | wc -l)
|
echo " ${num_packages} "
|
||||||
echo "${num_packages}" > ${listupdates_show}
|
|
||||||
fi
|
|
||||||
echo " $(cat ${listupdates_show}) "
|
|
||||||
# Check updates on Ubuntu/Debian/Devuan
|
# Check updates on Ubuntu/Debian/Devuan
|
||||||
elif [ -f /usr/bin/apt ] ; then
|
elif [ -f /usr/bin/apt ] ; then
|
||||||
if [ ${checkupdate} -ge ${checkupdates_run} ] ; then
|
if [ ${checkupdate} -ge ${checkupdates_run} ] ; then
|
||||||
sudo -A apt update > /dev/null 2>&1
|
sudo -A apt-get update > /dev/null 2>&1
|
||||||
echo "0" > ${checkupdates_file}
|
echo "0" > ${checkupdates_file}
|
||||||
fi
|
fi
|
||||||
if [ ${listupdate} -ge ${listupdates_run} ] ; then
|
num_packages=$(apt list --upgradable 2>/dev/null | grep -c ^)
|
||||||
num_packages=$(apt list --upgradable 2>/dev/null | grep -c ^)
|
num_packages=$(expr ${num_packages} - 1)
|
||||||
num_packages=$(expr ${num_packages} - 1)
|
echo " ${num_packages} "
|
||||||
echo "${num_packages}" > ${listupdates_show}
|
|
||||||
fi
|
|
||||||
echo " $(cat ${listupdates_show}) "
|
|
||||||
# Disable for other distros
|
# Disable for other distros
|
||||||
else
|
else
|
||||||
echo " 0 "
|
echo " 0 "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user