1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2020 Intel Corporation 4# All rights reserved. 5# Copyright (c) 2022 Dell Inc, or its subsidiaries. 6# 7 8disclaimer() { 9 case "$ID" in 10 rhel) 11 cat <<- WARN 12 13 WARNING: $PRETTY_NAME system detected. 14 15 Please, note that the support for this platform is considered to be "best-effort", 16 as in, access to some packages may be limited and/or missing. Review your repo 17 setup to make sure installation of all dependencies is possible. 18 19 WARN 20 21 # Don't trigger errexit, simply install what's available. This is default 22 # behavior of older yum versions (e.g. the one present on RHEL 7.x) anyway. 23 yum() { "$(type -P yum)" --skip-broken "$@"; } 24 # For systems which are not registered, subscription-manager will most likely 25 # fail on most calls so simply ignore its failures. 26 sub() { subscription-manager "$@" || :; } 27 ;; 28 29 *) ;; 30 esac 31} 32 33is_repo() { yum repolist --all | grep -q "^$1"; } 34 35disclaimer 36 37# First, add extra EPEL, ELRepo, Ceph repos to have a chance of covering most of the packages 38# on the enterprise systems, like RHEL. 39if [[ $ID == centos || $ID == rhel || $ID == rocky ]]; then 40 repos=() enable=("epel" "elrepo" "elrepo-testing") 41 [[ $ID == centos || $ID == rocky ]] && enable+=("extras") 42 if [[ $VERSION_ID == 7* ]]; then 43 repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm") 44 repos+=("https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm") 45 [[ $ID == centos ]] && repos+=("centos-release-ceph-nautilus.noarch") 46 [[ $ID == centos ]] && repos+=("centos-release-scl-rh") 47 # Disable liburing, see https://github.com/spdk/spdk/issues/1564 48 if [[ $INSTALL_LIBURING == true ]]; then 49 echo "Liburing not supported on ${ID}$VERSION_ID, disabling" 50 INSTALL_LIBURING=false 51 fi 52 fi 53 if [[ $VERSION_ID == 8* ]]; then 54 repos+=("https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm") 55 repos+=("https://www.elrepo.org/elrepo-release-8.el8.elrepo.noarch.rpm") 56 [[ $ID == centos || $ID == rocky ]] \ 57 && repos+=("https://download.ceph.com/rpm-nautilus/el8/noarch/ceph-release-1-1.el8.noarch.rpm") 58 # Add PowerTools needed for install CUnit-devel in Centos8 59 if [[ $ID == centos || $ID == rocky ]]; then 60 is_repo "PowerTools" && enable+=("PowerTools") 61 is_repo "powertools" && enable+=("powertools") 62 fi 63 fi 64 if ((${#repos[@]} > 0)); then 65 yum install -y "${repos[@]}" yum-utils 66 yum-config-manager --enable "${enable[@]}" 67 fi 68 # Potential dependencies can be needed from other RHEL repos, enable them 69 if [[ $ID == rhel ]]; then 70 [[ $VERSION_ID == 7* ]] && sub repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" 71 [[ $VERSION_ID == 8* ]] && sub repos --enable codeready-builder-for-rhel-8-x86_64-rpms 72 fi 73fi 74 75yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ 76 libuuid-devel libiscsi-devel ncurses-devel json-c-devel libcmocka-devel \ 77 clang clang-devel python3-pip 78 79# Minimal install 80# workaround for arm: ninja fails with dep on skbuild python module 81if [ "$(uname -m)" = "aarch64" ]; then 82 pip3 install scikit-build 83 if echo "$ID $VERSION_ID" | grep -E -q 'centos 7'; then 84 # by default centos 7.x uses cmake 2.8 while ninja requires 3.6 or higher 85 yum install -y cmake3 86 # cmake3 is installed as /usr/bin/cmake3 while ninja directly calls `cmake`. Create a soft link 87 # as a workaround 88 mkdir -p /tmp/bin/ 89 ln -s /usr/bin/cmake3 /tmp/bin/cmake > /dev/null 2>&1 || true 90 export PATH=/tmp/bin:$PATH 91 fi 92fi 93 94# for rhel and centos7 OpenSSL 1.1 should be installed via EPEL 95if echo "$ID $VERSION_ID" | grep -E -q 'centos 7|rhel 7'; then 96 yum install -y openssl11-devel 97fi 98if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rhel 8|rocky 8'; then 99 yum install -y python36 python36-devel 100 #Create hard link to use in SPDK as python 101 if [[ ! -e /usr/bin/python && -e /etc/alternatives/python3 ]]; then 102 ln -s /etc/alternatives/python3 /usr/bin/python 103 fi 104 # pip3, which is shipped with centos8 and rocky8, is currently providing faulty ninja binary 105 # which segfaults at each run. To workaround it, upgrade pip itself and then use it for each 106 # package - new pip will provide ninja at the same version but with the actually working 107 # binary. 108 pip3 install --upgrade pip 109 pip3() { /usr/local/bin/pip "$@"; } 110else 111 yum install -y python python3-devel 112fi 113pip3 install ninja 114pip3 install meson 115pip3 install pyelftools 116pip3 install ijson 117pip3 install python-magic 118if ! [[ $ID == centos && $VERSION_ID == 7 ]]; then 119 # Problem with modules compilation on Centos7 120 pip3 install grpcio 121 pip3 install grpcio-tools 122fi 123pip3 install pyyaml 124 125# Additional dependencies for SPDK CLI - not available in rhel and centos 126if ! echo "$ID $VERSION_ID" | grep -E -q 'rhel 7|centos 7'; then 127 yum install -y python3-configshell python3-pexpect 128fi 129# Additional dependencies for ISA-L used in compression 130yum install -y autoconf automake libtool help2man 131# Additional dependencies for DPDK 132yum install -y numactl-devel nasm 133# Additional dependencies for USDT 134yum install -y systemtap-sdt-devel 135if [[ $INSTALL_DEV_TOOLS == "true" ]]; then 136 # Tools for developers 137 devtool_pkgs=(git sg3_utils pciutils libabigail bash-completion ruby-devel) 138 139 if echo "$ID $VERSION_ID" | grep -E -q 'centos 8|rocky 8'; then 140 devtool_pkgs+=(python3-pycodestyle astyle) 141 echo "Centos 8 and Rocky 8 do not have lcov and ShellCheck dependencies" 142 elif [[ $ID == openeuler ]]; then 143 devtool_pkgs+=(python3-pycodestyle) 144 echo "openEuler does not have astyle, lcov and ShellCheck dependencies" 145 else 146 devtool_pkgs+=(python-pycodestyle astyle lcov ShellCheck) 147 fi 148 149 yum install -y "${devtool_pkgs[@]}" 150fi 151if [[ $INSTALL_PMEM == "true" ]]; then 152 # Additional dependencies for building pmem based backends 153 yum install -y libpmemobj-devel || true 154fi 155if [[ $INSTALL_FUSE == "true" ]]; then 156 # Additional dependencies for FUSE and NVMe-CUSE 157 yum install -y fuse3-devel 158fi 159if [[ $INSTALL_RBD == "true" ]]; then 160 # Additional dependencies for RBD bdev in NVMe over Fabrics 161 yum install -y librados-devel librbd-devel 162fi 163if [[ $INSTALL_RDMA == "true" ]]; then 164 # Additional dependencies for RDMA transport in NVMe over Fabrics 165 yum install -y libibverbs-devel librdmacm-devel 166fi 167if [[ $INSTALL_DOCS == "true" ]]; then 168 # Additional dependencies for building docs 169 yum install -y mscgen || echo "Warning: couldn't install mscgen via yum. Please install mscgen manually." 170 yum install -y doxygen graphviz 171fi 172if [[ $INSTALL_DAOS == "true" ]]; then 173 if [[ $ID == centos || $ID == rocky ]]; then 174 if ! hash yum-config-manager &> /dev/null; then 175 yum install -y yum-utils 176 fi 177 [[ $VERSION_ID == 7* ]] && yum-config-manager --add-repo "https://packages.daos.io/v2.0/CentOS7/packages/x86_64/daos_packages.repo" 178 [[ $VERSION_ID == 8* ]] && yum-config-manager --add-repo "https://packages.daos.io/v2.0/EL8/packages/x86_64/daos_packages.repo" 179 yum-config-manager --enable "daos-packages" 180 yum install -y daos-devel 181 else 182 echo "Skipping installation of DAOS bdev dependencies. It is supported only for CentOS 7, CentOS 8 and Rocky 8" 183 fi 184fi 185# Additional dependencies for Avahi 186if [[ $INSTALL_AVAHI == "true" ]]; then 187 # Additional dependencies for Avahi 188 yum install -y avahi-devel 189fi 190