Spdk/scripts/pkgdep.sh
paul luse eb53c23236 add (c) and SPDX header to bash files as needed
per Intel policy to include file commit date using git cmd
below.  The policy does not apply to non-Intel (C) notices.

git log --follow -C90% --format=%ad --date default <file> | tail -1

and then pull just the year from the result.

Intel copyrights were not added to files where Intel either had
no contribution ot the contribution lacked substance (ie license
header updates, formatting changes, etc)

For intel copyrights added, --follow and -C95% were used.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I2ef86976095b88a9bf5b1003e59f3943cd6bbe4c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15209
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2022-11-29 08:27:51 +00:00

120 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2017 Intel Corporation
# All rights reserved.
#
# Please run this script as root.
set -e
function usage() {
echo ""
echo "This script is intended to automate the installation of package dependencies to build SPDK."
echo "Please run this script as root user or with sudo -E."
echo ""
echo "$0"
echo " -h --help"
echo " -a --all"
echo " -d --developer-tools Install tools for developers (code styling, code coverage, etc.)"
echo " -p --pmem Additional dependencies for reduce, pmdk and pmdkobj"
echo " -f --fuse Additional dependencies for FUSE and NVMe-CUSE"
echo " -R --rbd Additional dependencies for RBD"
echo " -r --rdma Additional dependencies for RDMA transport in NVMe over Fabrics"
echo " -b --docs Additional dependencies for building docs"
echo " -u --uring Additional dependencies for io_uring"
echo " -D --daos Additional dependencies for DAOS"
echo ""
exit 0
}
function install_all_dependencies() {
INSTALL_DEV_TOOLS=true
INSTALL_PMEM=true
INSTALL_FUSE=true
INSTALL_RBD=true
INSTALL_RDMA=true
INSTALL_DOCS=true
INSTALL_LIBURING=true
INSTALL_DAOS=true
}
INSTALL_CRYPTO=false
INSTALL_DEV_TOOLS=false
INSTALL_PMEM=false
INSTALL_FUSE=false
INSTALL_RBD=false
INSTALL_RDMA=false
INSTALL_DOCS=false
INSTALL_LIBURING=false
INSTALL_DAOS=false
while getopts 'abdfhipruDR-:' optchar; do
case "$optchar" in
-)
case "$OPTARG" in
help) usage ;;
all) install_all_dependencies ;;
developer-tools) INSTALL_DEV_TOOLS=true ;;
pmem) INSTALL_PMEM=true ;;
fuse) INSTALL_FUSE=true ;;
rbd) INSTALL_RBD=true ;;
rdma) INSTALL_RDMA=true ;;
docs) INSTALL_DOCS=true ;;
uring) INSTALL_LIBURING=true ;;
daos) INSTALL_DAOS=true ;;
*)
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_RBD=true ;;
r) INSTALL_RDMA=true ;;
b) INSTALL_DOCS=true ;;
u) INSTALL_LIBURING=true ;;
D) INSTALL_DAOS=true ;;
*)
echo "Invalid argument '$OPTARG'"
usage
;;
esac
done
trap 'set +e; trap - ERR; echo "Error!"; exit 1;' ERR
scriptsdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $scriptsdir/..)
OS=$(uname -s)
if [[ -e /etc/os-release ]]; then
source /etc/os-release
elif [[ $OS == FreeBSD ]]; then
ID=freebsd
else
ID=unknown
fi
ID=${ID,,}
#Link suse related OS to sles
if [[ $ID == *"suse"* ]]; then
ID="sles"
fi
for id in $ID $ID_LIKE; do
if [[ -e $scriptsdir/pkgdep/$id.sh ]]; then
source "$scriptsdir/pkgdep/$id.sh"
source "$scriptsdir/pkgdep/common.sh"
exit 0
fi
done
printf 'Not supported distribution detected (%s), aborting\n' "$ID" >&2
exit 1