Merge "python: Pylint 1.8.2 code conformity"
[vswitchperf.git] / systems / rhel / 7.2 / build_base_machine.sh
1 #!/bin/bash
2 #
3 # Build a base machine for RHEL 7.3
4 #
5 # Copyright 2016 OPNFV, Intel Corporation & Red Hat Inc.
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #     http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 # Contributors:
20 #   Aihua Li, Huawei Technologies.
21 #   Martin Klozik, Intel Corporation.
22 #   Abdul Halim, Intel Corporation.
23 #   Christian Trautman, Red Hat Inc.
24
25 # Make and Compilers
26 pkglist=(\
27  automake\
28  fuse-devel\
29  gcc\
30  gcc-c++\
31  glib2-devel\
32  glibc\
33  kernel-devel\
34  openssl-devel\
35  pixman-devel\
36  sysstat\
37 )
38
39 # Tools
40 pkglist=(
41  "${pkglist[@]}"\
42  git\
43  libtool\
44  libpcap-devel\
45  libnet\
46  net-tools\
47  openssl\
48  openssl-devel\
49  pciutils\
50  socat\
51  tk-devel\
52  wget\
53  numactl\
54  numactl-devel\
55  libpng-devel\
56  sshpass\
57 )
58
59 # python tools for proper QEMU, DPDK, and OVS make
60 pkglist=(
61  "${pkglist[@]}"\
62  python-six\
63 )
64
65 # install RHEL compatible epel for sshpass
66 yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
67
68 # Iterate installing each package. If packages fail to install, record those
69 # packages and exit with an error message on completion. Customer may need to
70 # add repo locations and subscription levels.
71 failedinstall=()
72 for pkg in ${pkglist[*]}; do
73     echo "Installing ${pkg}"
74     yum -y install ${pkg} || failedinstall=("${failedinstall[*]}" "$pkg")
75 done
76
77 if [ "${#failedinstall[*]}" -gt 0 ]; then
78     echo "The following packages failed to install. Please add appropriate repo\
79  locations and/or subscription levels. Then run the build script again."
80     for fail in ${failedinstall[*]}; do
81         echo $fail
82     done
83     exit 1
84 fi
85
86 # install SCL for python34 by adding a repo to find its location to install it
87 cat <<'EOT' >> /etc/yum.repos.d/python34.repo
88 [centos-sclo-rh]
89 name=CentOS-7 - SCLo rh
90 baseurl=http://mirror.centos.org/centos/7/sclo/$basearch/rh/
91 gpgcheck=0
92 enabled=1
93 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
94 EOT
95
96 # install python34 packages and git-review tool
97 yum -y install $(echo "
98 rh-python34
99 rh-python34-python-tkinter
100 " | grep -v ^#)
101
102 # cleanup python 34 repo file
103 rm -f /etc/yum.repos.d/python34.repo
104
105 # Create hugepage dirs
106 mkdir -p /dev/hugepages