-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
pkgdep.sh
executable file
·140 lines (126 loc) · 3.68 KB
/
pkgdep.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/env bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2017 Intel Corporation
# All rights reserved.
# Copyright (c) 2022 Dell Inc, or its subsidiaries.
#
# 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"
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 " --uadk Additional dependencies for UADK"
echo " -D --daos Additional dependencies for DAOS"
echo " -A --avahi Additional dependencies for Avahi mDNS Discovery"
echo " -G --golang Additional dependencies for go API generation"
echo " -I --idxd Additional dependencies for IDXD"
echo ""
exit 0
}
function install_all_dependencies() {
INSTALL_DEV_TOOLS=true
INSTALL_PMEM=true
INSTALL_RBD=true
INSTALL_RDMA=true
INSTALL_DOCS=true
INSTALL_LIBURING=true
INSTALL_DAOS=true
INSTALL_AVAHI=true
INSTALL_GOLANG=true
INSTALL_IDXD=true
}
INSTALL_CRYPTO=false
INSTALL_DEV_TOOLS=false
INSTALL_PMEM=false
INSTALL_RBD=false
INSTALL_RDMA=false
INSTALL_DOCS=false
INSTALL_LIBURING=false
INSTALL_DAOS=false
INSTALL_AVAHI=false
INSTALL_GOLANG=false
INSTALL_IDXD=false
INSTALL_UADK=false
while getopts 'abdfhipruADGIR-:' optchar; do
case "$optchar" in
-)
case "$OPTARG" in
help) usage ;;
all) install_all_dependencies ;;
developer-tools) INSTALL_DEV_TOOLS=true ;;
pmem) INSTALL_PMEM=true ;;
rbd) INSTALL_RBD=true ;;
rdma) INSTALL_RDMA=true ;;
docs) INSTALL_DOCS=true ;;
uring) INSTALL_LIBURING=true ;;
uadk) INSTALL_UADK=true ;;
daos) INSTALL_DAOS=true ;;
avahi) INSTALL_AVAHI=true ;;
golang) INSTALL_GOLANG=true ;;
idxd) INSTALL_IDXD=true ;;
*)
echo "Invalid argument '$OPTARG'"
usage
;;
esac
;;
h) usage ;;
a) install_all_dependencies ;;
d) INSTALL_DEV_TOOLS=true ;;
p) INSTALL_PMEM=true ;;
R) INSTALL_RBD=true ;;
r) INSTALL_RDMA=true ;;
b) INSTALL_DOCS=true ;;
u) INSTALL_LIBURING=true ;;
D) INSTALL_DAOS=true ;;
A) INSTALL_AVAHI=true ;;
G) INSTALL_GOLANG=true ;;
I) INSTALL_IDXD=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/..)
source "$rootdir/scripts/common.sh"
source "$scriptsdir/pkgdep/helpers.sh"
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
# Some distros don't provide these paths in their default $PATH setups, nor
# sudo's secure_path, so add it here. These are needed since gem is most likely
# to put target bins at these locations.
export PATH=$PATH:/usr/local/bin:/usr/local/sbin
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