-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall-dep
More file actions
executable file
·136 lines (109 loc) · 2.61 KB
/
install-dep
File metadata and controls
executable file
·136 lines (109 loc) · 2.61 KB
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
#!/bin/bash
#
# A shell script to install dependencies including Linux and Python packages
#
set_proxy() {
echo 'set_proxy'
local proxy_host="web-proxy.labs.hpecorp.net"
local proxy_host_port="http://web-proxy.labs.hpecorp.net:8088"
if ping -q -c 1 -W 1 ${proxy_host} > /dev/null; then
HTTP_PROXY=${proxy_host_port}
fi
}
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
PATH=${PATH}:/sbin:/usr/sbin
# Check if a string (first argument) exists in the remaining argument list
list_has_string() {
local str=$1
shift
while test $# -gt 0
do
if [[ $1 == ${str} ]]; then
echo 'true'
return
fi
shift
done
echo 'false'
}
# Sets variables OS and VER to distribution family (e.g. Debian, Redhat)
# and version
distribution() {
if [ -f /etc/lsb-release ]; then
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
OS=Debian # XXX or Ubuntu??
VER=$(cat /etc/debian_version)
elif [ -f /etc/redhat-release ]; then
OS=Redhat # XXX or CentOS??
VER=$(cat /etc/redhat-release)
else
OS=$(uname -s)
VER=$(uname -r)
fi
}
# Installs L4TM packages
install_l4tm() {
printf "${GREEN}Installing L4TM packages... ${NC}\n"
sudo apt-get install -y \
cmake \
libattr1-dev \
libboost-all-dev \
libevent-dev \
libfam-atomic2 \
libfam-atomic2-dbg \
libfam-atomic2-dev \
libpmem \
libpmem-dev \
libnuma1 \
libnuma-dev \
libyaml-cpp-dev
}
# Installs Ubuntu packages
install_ubuntu() {
printf "${GREEN}Installing Ubuntu packages... ${NC}\n"
sudo apt-get install -y \
cmake \
libattr1-dev \
libboost-all-dev \
libevent-dev \
libnuma1 \
libnuma-dev \
libyaml-cpp-dev
}
# Installs RedHat packages
install_redhat() {
printf "${GREEN}Installing RedHat packages... ${NC}\n"
printf "${RED}Platform not supported ${NC}\n"
}
# Installs Python packages using PIP
install_pip() {
printf "${GREEN}Installing Python packages ${NC}\n"
pip install -r requirements.txt --proxy=${HTTP_PROXY}
}
usage() {
echo "Usage: $0 [--no-pip]"
exit
}
###########################################################################
# MAIN
###########################################################################
opts=${@:1}
if [[ $(list_has_string '--help' ${opts}) == "true" ]]; then
usage
fi
set_proxy
distribution # sets OS and VER
if [[ ${OS} == "Debian" ]]; then
install_l4tm
elif [[ ${OS} == "Ubuntu" ]]; then
install_ubuntu
elif [[ ${OS} == "Redhat" ]]; then
install_redhat
else
echo "Not supported distribution ${OS} ${VER}"
fi