bottlenecks create stack image
[bottlenecks.git] / utils / tools / ubuntu-server-clouding-modify.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2017 Huawei Technologies Co.,Ltd 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 # bottlenecks: this file is copied from yardstick and slightly modified
10 ##############################################################################
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 # Add hostname to /etc/hosts.
28 # Allow console access via pwd
29 cat <<EOF >/etc/cloud/cloud.cfg.d/10_etc_hosts.cfg
30 manage_etc_hosts: True
31 password: RANDOM
32 chpasswd: { expire: False }
33 ssh_pwauth: True
34 EOF
35
36 #install some software
37 apt-get update
38 apt-get install -y \
39     netperf \
40     sysstat
41
42 # restore symlink
43 ln -sf /run/resolvconf/resolv.conf /etc/resolv.conf