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