systems: Fix top level build_base_machine script to use ID
[vswitchperf.git] / systems / rhel / 7.2 / build_base_machine.sh
1 #!/bin/bash
2 #
3 # Build a base machine for RHEL 7.2
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.i686\
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 )
54
55 # python tools for proper QEMU, DPDK, and OVS make
56 pkglist=(
57  "${pkglist[@]}"\
58  python-six\
59 )
60
61 # Iterate installing each package. If packages fail to install, record those
62 # packages and exit with an error message on completion. Customer may need to
63 # add repo locations and subscription levels.
64 failedinstall=()
65 for pkg in ${pkglist[*]}; do
66     echo "Installing ${pkg}"
67     yum -y install ${pkg} || failedinstall=("${failedinstall[*]}" "$pkg")
68 done
69
70 if [ "${#failedinstall[*]}" -gt 0 ]; then
71     echo "The following packages failed to install. Please add appropriate repo\
72  locations and/or subscription levels. Then run the build script again."
73     for fail in ${failedinstall[*]}; do
74         echo $fail
75     done
76     exit 1
77 fi
78
79 # python34 is not yet available to Red Hat customers so we will just build
80 # it as an alternate install in usr/local for use with VSPerf. This prevents
81 # any functionality issues with pre-installed packages using python.
82 wget https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tar.xz
83 tar -xf Python-3.4.2.tar.xz
84 cd Python-3.4.2
85 ./configure
86 make
87 make altinstall
88 cd ..
89
90 # cleanup
91 rm -Rf Python-3.4.2
92 rm -f Python-3.4.2.tar.xz
93
94 # need virtualenv
95 pip3.4 install virtualenv
96
97 # Create hugepage dirs
98 mkdir -p /dev/hugepages