2018-10-01 18:47:23 +00:00
|
|
|
#!/usr/bin/env bash
|
2017-08-21 16:37:37 +00:00
|
|
|
# Please run this script as root.
|
|
|
|
|
2018-09-03 15:32:20 +00:00
|
|
|
set -e
|
2018-11-07 13:56:55 +00:00
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function usage() {
|
2018-11-07 13:56:55 +00:00
|
|
|
echo ""
|
|
|
|
echo "This script is intended to automate the installation of package dependencies to build SPDK."
|
2019-07-31 14:52:33 +00:00
|
|
|
echo "Please run this script as root user or with sudo -E."
|
2018-11-07 13:56:55 +00:00
|
|
|
echo ""
|
|
|
|
echo "$0"
|
|
|
|
echo " -h --help"
|
2020-01-14 09:59:31 +00:00
|
|
|
echo " -a --all"
|
|
|
|
echo " -d --developer-tools Install tools for developers (code styling, code coverage, etc.)"
|
2021-08-03 15:47:36 +00:00
|
|
|
echo " -p --pmem Additional dependencies for reduce, pmdk and pmdkobj"
|
2020-01-16 13:57:16 +00:00
|
|
|
echo " -f --fuse Additional dependencies for FUSE and NVMe-CUSE"
|
2020-01-17 08:30:24 +00:00
|
|
|
echo " -r --rdma Additional dependencies for RDMA transport in NVMe over Fabrics"
|
2020-01-17 09:39:19 +00:00
|
|
|
echo " -b --docs Additional dependencies for building docs"
|
2020-05-29 12:37:34 +00:00
|
|
|
echo " -u --uring Additional dependencies for io_uring"
|
2018-11-07 13:56:55 +00:00
|
|
|
echo ""
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2020-05-07 11:27:06 +00:00
|
|
|
function install_all_dependencies() {
|
2020-01-14 09:59:31 +00:00
|
|
|
INSTALL_DEV_TOOLS=true
|
2020-01-15 08:57:19 +00:00
|
|
|
INSTALL_PMEM=true
|
2020-01-16 13:57:16 +00:00
|
|
|
INSTALL_FUSE=true
|
2020-01-17 08:30:24 +00:00
|
|
|
INSTALL_RDMA=true
|
2020-01-17 09:39:19 +00:00
|
|
|
INSTALL_DOCS=true
|
2020-07-28 05:57:53 +00:00
|
|
|
INSTALL_LIBURING=true
|
2020-01-14 09:59:31 +00:00
|
|
|
}
|
|
|
|
|
2018-11-07 13:56:55 +00:00
|
|
|
INSTALL_CRYPTO=false
|
2020-01-14 09:59:31 +00:00
|
|
|
INSTALL_DEV_TOOLS=false
|
2020-01-15 08:57:19 +00:00
|
|
|
INSTALL_PMEM=false
|
2020-01-16 13:57:16 +00:00
|
|
|
INSTALL_FUSE=false
|
2020-01-17 08:30:24 +00:00
|
|
|
INSTALL_RDMA=false
|
2020-01-17 09:39:19 +00:00
|
|
|
INSTALL_DOCS=false
|
2020-05-29 12:37:34 +00:00
|
|
|
INSTALL_LIBURING=false
|
2018-11-07 13:56:55 +00:00
|
|
|
|
2020-05-29 12:37:34 +00:00
|
|
|
while getopts 'abdfhipru-:' optchar; do
|
2018-11-07 13:56:55 +00:00
|
|
|
case "$optchar" in
|
|
|
|
-)
|
2020-05-07 11:27:06 +00:00
|
|
|
case "$OPTARG" in
|
|
|
|
help) usage ;;
|
|
|
|
all) install_all_dependencies ;;
|
|
|
|
developer-tools) INSTALL_DEV_TOOLS=true ;;
|
|
|
|
pmem) INSTALL_PMEM=true ;;
|
|
|
|
fuse) INSTALL_FUSE=true ;;
|
|
|
|
rdma) INSTALL_RDMA=true ;;
|
|
|
|
docs) INSTALL_DOCS=true ;;
|
2020-05-29 12:37:34 +00:00
|
|
|
uring) INSTALL_LIBURING=true ;;
|
2020-05-07 11:27:06 +00:00
|
|
|
*)
|
|
|
|
echo "Invalid argument '$OPTARG'"
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
h) usage ;;
|
|
|
|
a) install_all_dependencies ;;
|
|
|
|
d) INSTALL_DEV_TOOLS=true ;;
|
|
|
|
p) INSTALL_PMEM=true ;;
|
|
|
|
f) INSTALL_FUSE=true ;;
|
|
|
|
r) INSTALL_RDMA=true ;;
|
|
|
|
b) INSTALL_DOCS=true ;;
|
2020-05-29 12:37:34 +00:00
|
|
|
u) INSTALL_LIBURING=true ;;
|
2020-05-07 11:27:06 +00:00
|
|
|
*)
|
|
|
|
echo "Invalid argument '$OPTARG'"
|
|
|
|
usage
|
|
|
|
;;
|
2018-11-07 13:56:55 +00:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2018-09-03 15:32:20 +00:00
|
|
|
trap 'set +e; trap - ERR; echo "Error!"; exit 1;' ERR
|
2017-08-21 16:37:37 +00:00
|
|
|
|
2018-08-18 16:25:41 +00:00
|
|
|
scriptsdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $scriptsdir/..)
|
|
|
|
|
2020-05-18 13:17:31 +00:00
|
|
|
OS=$(uname -s)
|
2020-01-14 09:59:31 +00:00
|
|
|
|
2020-05-18 13:17:31 +00:00
|
|
|
if [[ -e /etc/os-release ]]; then
|
|
|
|
source /etc/os-release
|
|
|
|
fi
|
2020-01-14 09:59:31 +00:00
|
|
|
|
2020-05-18 13:17:31 +00:00
|
|
|
ID=${ID:-$OS} ID=${ID,,}
|
|
|
|
|
2020-07-06 13:45:13 +00:00
|
|
|
#Link suse related OS to sles
|
|
|
|
if [[ ${ID,,} == *"suse"* ]]; then
|
|
|
|
ID="sles"
|
|
|
|
fi
|
|
|
|
|
2020-05-18 13:17:31 +00:00
|
|
|
if [[ -e $scriptsdir/pkgdep/$ID.sh ]]; then
|
|
|
|
source "$scriptsdir/pkgdep/$ID.sh"
|
2020-07-25 20:44:52 +00:00
|
|
|
source "$scriptsdir/pkgdep/common.sh"
|
2017-08-21 16:37:37 +00:00
|
|
|
else
|
2020-05-18 13:17:31 +00:00
|
|
|
printf 'Not supported platform detected (%s), aborting\n' "$ID" >&2
|
2017-08-21 16:37:37 +00:00
|
|
|
fi
|