forked from crowbar/crowbar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-installer.sh
executable file
·61 lines (51 loc) · 2.22 KB
/
run-installer.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Copyright 2011, Dell
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# README:
# This script runs an installer image as a virtual machine allowing you to
# bootstrap an admin node.
# This script expects to be able to run certian commands as root.
# Either run it as a user who can sudo to root, or give the user
# you are running it as the following sudo rights:
# crowbar-tester ALL = NOPASSWD: /bin/mount, /bin/umount, /bin/ip, /usr/sbin/brctl, /home/crowbar-tester/test_framework/make-cgroups.sh
# We use bash4 specific functionality (hash tables), and cgroups to
# make sure we clean up everything when we exit a test run.
# You will need a fairly recent Linux distro to run this test --
# RHEL/CentOS 5 will not work without some significant rework.
readonly currdir="$PWD"
# Location of the Crowbar checkout we are building from.
[[ $CROWBAR_DIR ]] || CROWBAR_DIR="${0%/*}"
[[ $CROWBAR_DIR = /* ]] || CROWBAR_DIR="$currdir/$CROWBAR_DIR"
[[ -f $CROWBAR_DIR/build_crowbar.sh && -d $CROWBAR_DIR/.git ]] || \
die "$CROWBAR_DIR is not a git checkout of Crowbar!"
export CROWBAR_DIR
. "$CROWBAR_DIR/build_lib.sh"
. "$CROWBAR_DIR/test_lib.sh"
SMOKETEST_BRIDGES=(deploy-br)
NICS_PER_BRIDGE=1
[[ -f $1 && $1 = *Crowbar_Installer.vmdk ]] || \
die "$1 is not a crowbar installer disk image!"
[[ -f $2 && $2 = *crowbar-*.iso ]] || \
die "$2 is not a crowbar ISO!"
[[ -d /sys/class/net/$3 ]] || \
die "$3 is not an interface to let the installer serve PXE boots!"
PHYSICAL_INTERFACES=("$3,deploy-br")
make_virt_net
"$KVM" -drive "file=$1,if=ide,media=disk,snapshot=on" \
-cdrom "$2" \
-net "nic,macaddr=52:54:00:00:00:8f,model=e1000" \
-net "tap,ifname=admin-0-br,script=no,downscript=no" \
-m 512 -snapshot
kill_virt_net