Look for all qemu-img/kvm package names in rhel-based distros

"yum install qemu-img" will get the correct package in all cases, but
it can be called qemu-img, qemu-img-ev, qemu-img-rhev, ...
So use a wildcard in package search to allow for all variants

Also use "yum info" instead of "yum list", it is faster and skips online
updates

Change-Id: I4b015858600a573091ab51fc9132577abfebbd0a
This commit is contained in:
Bernard Cafarelli 2017-03-16 16:50:40 +01:00
parent fc675669d6
commit dc98000fb7
No known key found for this signature in database
GPG Key ID: D148244A3C2462BD
1 changed files with 8 additions and 8 deletions

View File

@ -260,7 +260,7 @@ if [ "$platform" = 'NAME="Ubuntu"' ]; then
elif [ "$platform" = 'NAME=Fedora' ]; then
PKG_LIST="qemu kpartx git"
for pkg in $PKG_LIST; do
if ! yum list installed $pkg &> /dev/null; then
if ! yum info installed $pkg &> /dev/null; then
echo "Required package " $pkg " is not installed. Exiting."
exit 1
fi
@ -269,16 +269,16 @@ else
# centos or rhel
PKG_LIST="qemu-kvm qemu-img"
for pkg in $PKG_LIST; do
if ! yum list installed $pkg &> /dev/null; then
if ! yum list installed $pkg"-ev" &> /dev/null; then
echo "Required package " $pkg " or " $pkg"-ev" " is not installed. Exiting."
exit 1
fi
# Actual name may be qemu-img, qemu-img-ev, qemu-img-rhev, ...
# "yum install qemu-img" works for all, but search requires wildcard
if ! yum info installed ${pkg}* &> /dev/null; then
echo "Required package " $pkg " is not installed. Exiting."
exit 1
fi
done
PKG_LIST="kpartx git"
for pkg in $PKG_LIST; do
if ! yum list installed $pkg &> /dev/null; then
if ! yum info installed $pkg &> /dev/null; then
echo "Required package " $pkg " is not installed. Exiting."
exit 1
fi
@ -287,7 +287,7 @@ else
if [ ${platform:0:6} = "CentOS" ]; then
# install EPEL repo, in order to install argparse
PKG_LIST="python-argparse"
if ! yum list installed $pkg &> /dev/null; then
if ! yum info installed $pkg &> /dev/null; then
echo "CentOS requires the python-argparse package be "
echo "installed separately from the EPEL repo."
echo "Required package " $pkg " is not installed. Exiting."