misc/upgrades-installed-check: handle apt-get errors

This commit is contained in:
Patrick Schleizer 2015-11-11 21:13:17 +00:00
parent d5acf83916
commit 52917593c5
No known key found for this signature in database
GPG Key ID: CB8D50BB77BB3C48

View File

@ -15,6 +15,8 @@ if [ -e /etc/system-release ]; then
[ "$exit_code" -eq 0 ] && echo "true"
else
## Debian
set -e
set -o pipefail
apt_get_output="$(LANG="C" apt-get -s upgrade 2>&1)"
exit_code="$?"
echo "$apt_get_output" | awk "/^Inst/{ print $2 }" | [ "$(wc -L)" -eq 0 ] && echo "true" || echo "false"