From 8cf4a7af05b5dc2dcba16ccdcdeb7d2ac0e8f95b Mon Sep 17 00:00:00 2001 From: Pawel Wodkowski Date: Mon, 3 Sep 2018 17:38:37 +0200 Subject: [PATCH] scripts/pkgdep.sh: distinguish Fedora, CentOS and RHEL Fixes #417 Change-Id: Ic2f00d624c9e20386aab1eb1ba0e24d12fdf56d8 Signed-off-by: Pawel Wodkowski Reviewed-on: https://review.gerrithub.io/424413 Reviewed-by: Jim Harris Reviewed-by: Ben Walker Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins --- scripts/pkgdep.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scripts/pkgdep.sh b/scripts/pkgdep.sh index 9491f59784..1d071eccc9 100755 --- a/scripts/pkgdep.sh +++ b/scripts/pkgdep.sh @@ -8,11 +8,22 @@ scriptsdir=$(readlink -f $(dirname $0)) rootdir=$(readlink -f $scriptsdir/..) if [ -s /etc/redhat-release ]; then - # Includes Fedora, CentOS - if [ -f /etc/centos-release ]; then - # Add EPEL repository for CUnit-devel - yum --enablerepo=extras install -y epel-release + . /etc/os-release + + # Includes Fedora, CentOS 7, RHEL 7 + # Add EPEL repository for CUnit-devel and libunwind-devel + if echo "$ID $VERSION_ID" | egrep -q 'rhel 7|centos 7'; then + if ! rpm --quiet -q epel-release; then + yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + fi + + if [ $ID = 'rhel' ]; then + subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" + elif [ $ID = 'centos' ]; then + yum --enablerepo=extras install -y epel-release + fi fi + yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ git astyle python-pep8 lcov python clang-analyzer libuuid-devel \ sg3_utils libiscsi-devel pciutils