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