dom0-updates: fix reporting when no updates are available

Check `yum check-update` exit code, instead of `grep` - when there are
multiple commands on the single line, $? contains exit code of the last
executed.

Fixes QubesOS/qubes-issues#1475

(cherry picked from commit c46c1e4d2c)
This commit is contained in:
Marek Marczykowski-Górecki 2015-12-26 04:43:23 +01:00
parent e22e327939
commit e9d1bc1710
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -82,8 +82,9 @@ fi
if [ "x$PKGLIST" = "x" ]; then
echo "Checking for dom0 updates..." >&2
UPDATES_FULL=`$YUM $OPTS check-update | grep -v "^Loaded plugins:\|^$"`
UPDATES_FULL=`$YUM $OPTS check-update`
check_update_retcode=$?
UPDATES_FULL=`echo "$UPDATES_FULL" | grep -v "^Loaded plugins:\|^$"`
if [ $check_update_retcode -eq 1 ]; then
# Exit here if yum have reported an error. Exit code 100 isn't an
# error, it's "updates available" info, so check specifically for exit code 1