From a9e7f91ca653ae4d474727844160a1567a094435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Sun, 4 Dec 2016 22:37:17 +0100 Subject: [PATCH] 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 --- misc/qubes-download-dom0-updates.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/misc/qubes-download-dom0-updates.sh b/misc/qubes-download-dom0-updates.sh index 08c537a..3facc39 100755 --- a/misc/qubes-download-dom0-updates.sh +++ b/misc/qubes-download-dom0-updates.sh @@ -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