Small yum_update.sh improvements

Following the revert due to issue with repoquery in
Id12743c0cf83d054189df10cad2c8abec57961e8, re-submitting the two
unrelated changes. Follow-up patch to come for handling repoquery more
sanely.

* Use the --quiet flag with repoquery

  This prevents notices such as subscription-related stderr warnings
  from being added to the output and messing with the sorted order.

* Remove the : after else

  It seems using else without a colon is the bash standard. This gets
  rid of the following error on RHEL8:
  "/tmp/yum_update.sh: line 34: else:: command not found"

Change-Id: I8e52f239fcf962c17543ba56d3653de0016ed47f
This commit is contained in:
Julie Pichon 2019-05-08 17:17:14 +01:00
parent f33cad7443
commit 367f3e032a
1 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ set -eou pipefail
packages_for_update=
if [ -n "$1" ] && command -v repoquery >/dev/null 2>&1; then
installed_versions=$(rpm -qa --qf "%{NAME} = %{VERSION}-%{RELEASE}\n" | sort)
available_versions=$(repoquery --provides --disablerepo='*' --enablerepo=$1 -a | sort)
available_versions=$(repoquery --quiet --provides --disablerepo='*' --enablerepo=$1 -a | sort)
uptodate_versions=$(comm -12 <(printf "%s\n" "$installed_versions") <(printf "%s\n" "$available_versions"))
@ -29,7 +29,7 @@ if [ $PKG_MGR == "dnf" ]; then
if ! echo $installed | grep -qw dnf-plugins-core; then
$PKG install -y dnf-plugins-core
fi
else:
else
if ! echo $installed | grep -qw yum-plugin-priorities; then
$PKG install -y yum-plugin-priorities
fi