Fix detection of dom0 updates

dnf stdout messages differ from yum. Handle this particular difference
(info about last metadata check time), but in addition properly use its
exit code - 0 means no updates, 100 means some updates.

Fixes QubesOS/qubes-issues#2096
This commit is contained in:
Marek Marczykowski-Górecki 2016-12-04 22:37:17 +01:00
parent bb53619d3d
commit a9e7f91ca6
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -84,7 +84,7 @@ if [ "x$PKGLIST" = "x" ]; then
echo "Checking for dom0 updates..." >&2
UPDATES_FULL=`$YUM $OPTS check-update`
check_update_retcode=$?
UPDATES_FULL=`echo "$UPDATES_FULL" | grep -v "^Loaded plugins:\|^$"`
UPDATES_FULL=`echo "$UPDATES_FULL" | grep -v "^Loaded plugins:\|^Last metadata\|^$"`
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
@ -95,6 +95,9 @@ if [ "x$PKGLIST" = "x" ]; then
# save not empty string for below condition (-z "$UPDATES"), but blank
# to not confuse the user wwith magic strings in messages
UPDATES=" "
elif [ $check_update_retcode -eq 0 ]; then
# exit code 0 means no updates available - regardless of stdout messages
UPDATES=""
fi
else
PKGS_FROM_CMDLINE=1