-
Notifications
You must be signed in to change notification settings - Fork 74
/
linux-install-software
executable file
·124 lines (113 loc) · 3.97 KB
/
linux-install-software
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
#!/bin/bash
#
# Copyright (C) Extensible Service Proxy Authors
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
################################################################################
#
# May require sudo login.
if [[ "$(uname)" != "Linux" ]]; then
echo "Run on Linux only."
exit 1
fi
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
. ${DIR}/all-utilities || { echo "Cannot load Bash utilities" ; exit 1 ; }
# TOOLS
. ${DIR}/tools/linux-install-bazel || error_exit "Cannot load Bazel install script"
. ${DIR}/tools/linux-install-docker || error_exit "Cannot load Docker install script"
. ${DIR}/tools/linux-install-clang || error_exit "Cannot load Clang install script"
. ${DIR}/tools/linux-install-gcloud || error_exit "Cannot load gcloud install script"
. ${DIR}/tools/linux-install-wrk || error_exit "Cannot load wrk install script"
. ${DIR}/tools/linux-install-nodejs || error_exit "Cannot load nodejs install script"
export DEBIAN_FRONTEND=noninteractive
function install_packages() {
echo "Installing tools."
clear_apt \
&& ${SUDO} apt-get -qqy install \
apt-transport-https \
autoconf \
automake \
autotools-dev \
ca-certificates \
curl \
ca-certificates-java \
g++ \
gcc \
gettext \
git \
lcov \
libev-dev \
libevent-dev \
libjemalloc-dev \
libssl-dev \
libio-socket-ssl-perl \
libjson-perl \
libtool \
libyaml-dev \
make \
openjdk-8-jdk-headless \
python-pip \
pkg-config \
unzip \
uuid-dev \
uuid-runtime \
wget \
zip \
zlib1g-dev \
&& return 0
return 1
# openjdk-8-source
}
while getopts :b:p: arg; do
case ${arg} in
p) PLATFORM="${OPTARG}";;
b) TOOLS_BUCKET="${OPTARG}";;
esac
done
[[ -z "${PLATFORM}" ]] && error_exit 'PLATFORM is not set'
echo 'Clearing packages in apt'
${SUDO} apt-get clean
# Installing dependencies
retry install_packages || error_exit 'Cannot install required packages.'
retry ${SUDO} pip install --upgrade python-gflags || error_exit 'Cannot install gflags.'
retry ${SUDO} pip install --upgrade certifi || error_exit 'Cannot install certifi.'
retry ${SUDO} pip install --upgrade oauth2client || error_exit 'Cannot install oauth2client.'
retry ${SUDO} pip install --upgrade urllib3 || error_exit 'Cannot install urllib3.'
retry ${SUDO} pip install --upgrade prettytable Mako pyaml dateutils || error_exit 'Cannot install prettytable Mako pyaml dateutils.'
# Installing tools
echo "Installing tools if necessary"
if [[ -d "${TOOLS_DIR}" ]]; then
[[ -n "${SUDO}" ]] && ${SUDO} chown -R "${USER}" "${TOOLS_DIR}"
else
mkdir -p "${TOOLS_DIR}" -m 0777
fi
update_clang
update_gcloud
update_bazel
install_docker_for_debian9
update_wrk
update_node_js
install_clang_format_7
clear_apt
echo "Software installation complete."