]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | #!/usr/bin/env bash |
2 | # Please run this script as root. | |
3 | ||
4 | set -e | |
9f95a23c TL |
5 | |
6 | function usage() | |
7 | { | |
8 | echo "" | |
9 | echo "This script is intended to automate the installation of package dependencies to build SPDK." | |
10 | echo "Please run this script as root user." | |
11 | echo "" | |
12 | echo "$0" | |
13 | echo " -h --help" | |
14 | echo "" | |
15 | exit 0 | |
16 | } | |
17 | ||
18 | INSTALL_CRYPTO=false | |
19 | ||
20 | while getopts 'hi-:' optchar; do | |
21 | case "$optchar" in | |
22 | -) | |
23 | case "$OPTARG" in | |
24 | help) usage;; | |
25 | *) echo "Invalid argument '$OPTARG'" | |
26 | usage;; | |
27 | esac | |
28 | ;; | |
29 | h) usage;; | |
30 | *) echo "Invalid argument '$OPTARG'" | |
31 | usage;; | |
32 | esac | |
33 | done | |
34 | ||
11fdf7f2 TL |
35 | trap 'set +e; trap - ERR; echo "Error!"; exit 1;' ERR |
36 | ||
37 | scriptsdir=$(readlink -f $(dirname $0)) | |
38 | rootdir=$(readlink -f $scriptsdir/..) | |
39 | ||
40 | if [ -s /etc/redhat-release ]; then | |
41 | . /etc/os-release | |
42 | ||
43 | # Includes Fedora, CentOS 7, RHEL 7 | |
44 | # Add EPEL repository for CUnit-devel and libunwind-devel | |
45 | if echo "$ID $VERSION_ID" | egrep -q 'rhel 7|centos 7'; then | |
46 | if ! rpm --quiet -q epel-release; then | |
47 | yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
48 | fi | |
49 | ||
50 | if [ $ID = 'rhel' ]; then | |
51 | subscription-manager repos --enable "rhel-*-optional-rpms" --enable "rhel-*-extras-rpms" | |
52 | elif [ $ID = 'centos' ]; then | |
53 | yum --enablerepo=extras install -y epel-release | |
54 | fi | |
55 | fi | |
56 | ||
57 | yum install -y gcc gcc-c++ make CUnit-devel libaio-devel openssl-devel \ | |
9f95a23c | 58 | git astyle python-pycodestyle lcov python clang-analyzer libuuid-devel \ |
11fdf7f2 TL |
59 | sg3_utils libiscsi-devel pciutils |
60 | # Additional (optional) dependencies for showing backtrace in logs | |
61 | yum install -y libunwind-devel || true | |
62 | # Additional dependencies for NVMe over Fabrics | |
63 | yum install -y libibverbs-devel librdmacm-devel | |
64 | # Additional dependencies for DPDK | |
65 | yum install -y numactl-devel nasm | |
66 | # Additional dependencies for building docs | |
67 | yum install -y doxygen mscgen graphviz | |
68 | # Additional dependencies for building pmem based backends | |
69 | yum install -y libpmemblk-devel || true | |
70 | # Additional dependencies for SPDK CLI - not available in rhel and centos | |
71 | if ! echo "$ID $VERSION_ID" | egrep -q 'rhel 7|centos 7'; then | |
72 | yum install -y python3-configshell python3-pexpect | |
73 | fi | |
9f95a23c TL |
74 | # Additional dependencies for ISA-L used in compression |
75 | yum install -y autoconf automake libtool help2man | |
11fdf7f2 TL |
76 | elif [ -f /etc/debian_version ]; then |
77 | # Includes Ubuntu, Debian | |
78 | apt-get install -y gcc g++ make libcunit1-dev libaio-dev libssl-dev \ | |
79 | git astyle pep8 lcov clang uuid-dev sg3-utils libiscsi-dev pciutils | |
9f95a23c TL |
80 | # Additional python style checker not available on ubuntu 16.04 or earlier. |
81 | apt-get install -y pycodestyle || true | |
11fdf7f2 TL |
82 | # Additional (optional) dependencies for showing backtrace in logs |
83 | apt-get install -y libunwind-dev || true | |
84 | # Additional dependencies for NVMe over Fabrics | |
85 | apt-get install -y libibverbs-dev librdmacm-dev | |
86 | # Additional dependencies for DPDK | |
87 | apt-get install -y libnuma-dev nasm | |
88 | # Additional dependencies for building docs | |
89 | apt-get install -y doxygen mscgen graphviz | |
9f95a23c TL |
90 | # Additional dependencies for SPDK CLI - not available on older Ubuntus |
91 | apt-get install -y python3-configshell-fb python3-pexpect || echo \ | |
92 | "Note: Some SPDK CLI dependencies could not be installed." | |
93 | # Additional dependencies for ISA-L used in compression | |
94 | apt-get install -y autoconf automake libtool help2man | |
95 | # Additional dependecies for nvmf performance test script | |
96 | apt-get install -y python3-paramiko | |
97 | elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then | |
11fdf7f2 | 98 | zypper install -y gcc gcc-c++ make cunit-devel libaio-devel libopenssl-devel \ |
9f95a23c | 99 | git-core lcov python-base python-pycodestyle libuuid-devel sg3_utils pciutils |
11fdf7f2 TL |
100 | # Additional (optional) dependencies for showing backtrace in logs |
101 | zypper install libunwind-devel || true | |
102 | # Additional dependencies for NVMe over Fabrics | |
103 | zypper install -y rdma-core-devel | |
104 | # Additional dependencies for DPDK | |
105 | zypper install -y libnuma-devel nasm | |
106 | # Additional dependencies for building pmem based backends | |
107 | zypper install -y libpmemblk-devel | |
108 | # Additional dependencies for building docs | |
109 | zypper install -y doxygen mscgen graphviz | |
9f95a23c TL |
110 | # Additional dependencies for ISA-L used in compression |
111 | zypper install -y autoconf automake libtool help2man | |
11fdf7f2 TL |
112 | elif [ $(uname -s) = "FreeBSD" ] ; then |
113 | pkg install -y gmake cunit openssl git devel/astyle bash py27-pycodestyle \ | |
114 | python misc/e2fsprogs-libuuid sysutils/sg3_utils nasm | |
115 | # Additional dependencies for building docs | |
116 | pkg install -y doxygen mscgen graphviz | |
9f95a23c TL |
117 | # Additional dependencies for ISA-L used in compression |
118 | pkg install -y autoconf automake libtool help2man | |
11fdf7f2 TL |
119 | else |
120 | echo "pkgdep: unknown system type." | |
121 | exit 1 | |
122 | fi |