ソースを参照

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
Marek Marczykowski-Górecki 7 年 前
コミット
a9e7f91ca6
1 ファイル変更4 行追加1 行削除
  1. 4 1
      misc/qubes-download-dom0-updates.sh

+ 4 - 1
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