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
This commit is contained in:
Marek Marczykowski-Górecki 2015-12-26 04:43:23 +01:00
parent 2478cb5c05
commit c46c1e4d2c
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -80,8 +80,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