Added a Yardstick test scenario for the OPNFV-Playground development CI pipeline
[yardstick.git] / tools / ubuntu-server-cloudimg-modify.sh
1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 #!/bin/bash
11
12 # installs required packages
13 # must be run from inside the image (either chrooted or running)
14
15 set -ex
16
17 if [ $# -eq 1 ]; then
18     nameserver_ip=$1
19
20     # /etc/resolv.conf is a symbolic link to /run, restore at end
21     rm /etc/resolv.conf
22     echo "nameserver $nameserver_ip" > /etc/resolv.conf
23     echo "nameserver 8.8.8.8" >> /etc/resolv.conf
24     echo "nameserver 8.8.4.4" >> /etc/resolv.conf
25 fi
26
27 # iperf3 only available for trusty in backports
28 grep trusty /etc/apt/sources.list && \
29     echo "deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
30
31 # Workaround for building on CentOS (apt-get is not working with http sources)
32 # sed -i 's/http/ftp/' /etc/apt/sources.list
33
34 # Force apt to use ipv4 due to build problems on LF POD.
35 echo 'Acquire::ForceIPv4 "true";' > /etc/apt/apt.conf.d/99force-ipv4
36
37 # Add hostname to /etc/hosts.
38 cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg
39 manage_etc_hosts: True
40 EOF
41
42 apt-get update
43 apt-get install -y \
44     fio \
45     git \
46     gcc \
47     iperf3 \
48     linux-tools-common \
49     linux-tools-generic \
50     lmbench \
51     make \
52     netperf \
53     patch \
54     perl \
55     rt-tests \
56     stress \
57     sysstat
58
59 git clone https://github.com/kdlucas/byte-unixbench.git /opt/tempT
60 make --directory /opt/tempT/UnixBench/
61 # restore symlink
62 ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf