From 90ec2ae622ce9db06fa023422938eae1ee919660 Mon Sep 17 00:00:00 2001 From: Carlos Goncalves Date: Sat, 8 Sep 2018 02:52:27 +0200 Subject: [PATCH] Support DNF package manager in diskimage-create DNF is the next upcoming major version of Yum. It has been the default package manager since Fedora 22. This patch tries to use DNF if available, and falls back to Yum. Change-Id: Ic011ef8281eb99ae010c61f47a8423bc186c25b7 --- diskimage-create/diskimage-create.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/diskimage-create/diskimage-create.sh b/diskimage-create/diskimage-create.sh index fd388684cb..cde50a0c9c 100755 --- a/diskimage-create/diskimage-create.sh +++ b/diskimage-create/diskimage-create.sh @@ -298,10 +298,11 @@ elif [[ $platform =~ "SUSE" ]]; then else # fedora/centos/rhel # Actual qemu-img name may be qemu-img, qemu-img-ev, qemu-img-rhev, ... - # "yum install qemu-img" works for all, but search requires wildcard + # "dnf|yum install qemu-img" works for all, but search requires wildcard + PKG_MGR=$(which dnf &>/dev/null && echo dnf || echo yum) PKG_LIST="qemu-img* git" for pkg in $PKG_LIST; do - if ! yum info installed $pkg &> /dev/null; then + if ! $PKG_MGR info installed $pkg &> /dev/null; then echo "Required package " ${pkg/\*} " is not installed. Exiting." exit 1 fi