fixed updates not displaying

This commit is contained in:
pyr0ball 2023-03-08 13:25:19 -08:00
parent 3983cf6721
commit 5d829b31d8

View file

@ -42,9 +42,6 @@ cache=$(echo "${cachefile_location}/${cachefile}")
################################ ################################
quickinfo-cache (){ quickinfo-cache (){
#check for updates
packages_cache=$(/usr/lib/update-notifier/apt-check --human-readable | grep "can be")
supdates_cache=$(/usr/lib/update-notifier/apt-check --human-readable | grep "security updates")
# Uses a wide variety of methods to check which distro this is run on # Uses a wide variety of methods to check which distro this is run on
if type lsb_release >/dev/null 2>&1; then if type lsb_release >/dev/null 2>&1; then
# linuxbase.org # linuxbase.org
@ -79,7 +76,9 @@ else
OS=$(uname -s) OS=$(uname -s)
VER=$(uname -r) VER=$(uname -r)
fi fi
#check for updates
packages_cache=$(/usr/lib/update-notifier/apt-check --human-readable | grep "can be")
supdates_cache=$(/usr/lib/update-notifier/apt-check --human-readable | grep "security updates")
# Echo the parameters out to the cache file with a "key" marker # Echo the parameters out to the cache file with a "key" marker
# at the beginning of the line. This key is used to pull the specific # at the beginning of the line. This key is used to pull the specific
# line needed for each parameter using grep, then cut out of the # line needed for each parameter using grep, then cut out of the
@ -253,7 +252,7 @@ fi
# Check for release upgrade # Check for release upgrade
if [ -x /usr/lib/ubuntu-release-upgrader/release-upgrade-motd ]; then if [ -x /usr/lib/ubuntu-release-upgrader/release-upgrade-motd ]; then
release_upgrade=`exec /usr/lib/ubuntu-release-upgrader/release-upgrade-motd` release_upgrade=$(cat /var/lib/ubuntu-release-upgrader/release-upgrade-available)
fi fi
if [ "$(lsb_release -sd | cut -d' ' -f4)" = "(development" ]; then if [ "$(lsb_release -sd | cut -d' ' -f4)" = "(development" ]; then
unset release_upgrade unset release_upgrade
@ -269,8 +268,8 @@ fi
################################ ################################
# Check if reboot required by updates # Check if reboot required by updates
if [ -x /usr/lib/update-notifier/update-motd-reboot-required ]; then if [ -f /var/run/reboot-required ]; then
reboot_required=`exec /usr/lib/update-notifier/update-motd-reboot-required` reboot_required=$(cat /var/run/reboot-required)
fi fi
################################ ################################
@ -305,6 +304,18 @@ usages=($(awk '{print $5}' <<< "${diskinfo}"))
freespaces=($(awk '{print $4}' <<< "${diskinfo}")) freespaces=($(awk '{print $4}' <<< "${diskinfo}"))
################################ ################################
#check for updates
packages=$(/usr/lib/update-notifier/apt-check --human-readable | grep "can be")
supdates=$(/usr/lib/update-notifier/apt-check --human-readable | grep "security updates" | cut -d '.' -f1)
packages=${packages%%\.*}
supdates=${supdates%%\.*}
# Check for updates
if [[ $(echo ${packages} | grep -c updates) != 1 ]] || [ -z "${supdates}" ] || [ -z "${release_upgrade}" ] ; then
#if [[ $(echo ${packages} | grep -c ^0\ updates) == 1 ]] ; then
need_updates=false
else
need_updates=true
fi
# Begin echo out of formatted table with aggregated information # Begin echo out of formatted table with aggregated information
@ -331,12 +342,6 @@ for((i=0; i<"${#logicals[@]}"; i++ )); do
boxline "\t$(printf '|%-4s\t%-4s\t%-4s\t%-4s\n' ${usages[$i]} ${freespaces[$i]} ${mounts[$i]} ${logicals[$i]})" boxline "\t$(printf '|%-4s\t%-4s\t%-4s\t%-4s\n' ${usages[$i]} ${freespaces[$i]} ${mounts[$i]} ${logicals[$i]})"
done done
boxline "" boxline ""
if [[ $(echo ${packages} | grep -c ^0\ updates) != 1 ]] || [ -z "${supdates}" ] || [ -z "${release_upgrade}" ] ; then
#if [[ $(echo ${packages} | grep -c ^0\ updates) == 1 ]] ; then
need_updates=false
else
need_updates=true
fi
if [[ "$need_updates" == "true" ]] ; then if [[ "$need_updates" == "true" ]] ; then
boxline "${bld}${unl}Updates${dfl}" boxline "${bld}${unl}Updates${dfl}"
boxline " ${packages}" boxline " ${packages}"