dom0-updates: do not use 'yum check-update -q'

Depending on yum version, adding '-q' option may hide not only
informational messages, but also updates list. This is especially the
case for yum-deprecated in Fedora 22.
So instead of '-q' option, filter the output manually.

QubesOS/qubes-issues#1282
This commit is contained in:
Marek Marczykowski-Górecki 2015-11-11 05:14:16 +01:00
parent 3466f3df35
commit 49c7473848
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -80,14 +80,14 @@ fi
if [ "x$PKGLIST" = "x" ]; then
echo "Checking for dom0 updates..." >&2
UPDATES_FULL=`$YUM $OPTS check-update -q`
UPDATES_FULL=`$YUM $OPTS check-update | grep -v "^Loaded plugins:\|^$"`
check_update_retcode=$?
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
exit 1
fi
UPDATES=`echo "$UPDATES_FULL" | cut -f 1 -d ' ' | grep -v "^Obsoleting"`
UPDATES=`echo "$UPDATES_FULL" | grep -v "^Obsoleting\|Could not" | cut -f 1 -d ' '`
if [ -z "$UPDATES" -a $check_update_retcode -eq 100 ]; then
# save not empty string for below condition (-z "$UPDATES"), but blank
# to not confuse the user wwith magic strings in messages
@ -106,7 +106,8 @@ if [ -z "$PKGLIST" -a -z "$UPDATES" ]; then
fi
if [ "$CHECK_ONLY" = "1" ]; then
echo "Available updates: $UPDATES_FULL"
echo "Available updates: "
echo "$UPDATES_FULL"
exit 100
fi