c2977896fbc41bce1b011a674aa4641b12bcbe7e
[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 fi
24
25 # iperf3 only available for trusty in backports
26 grep trusty /etc/apt/sources.list && \
27     echo "deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse" >> /etc/apt/sources.list
28 apt-get update
29 apt-get install -y \
30     iperf3 \
31     lmbench \
32     stress
33
34 # restore symlink
35 ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf
36