simpler arg passing to the start-qemu-node script
[tests.git] / system / template-qemu / start-qemu-node
1 #!/bin/bash
2
3 # cd in this command's directory
4 cd $(dirname $0)
5
6 #Getting the env. as passed by the test framework - mostly MACADDR and NODE_ISO
7 CONFIG=start-qemu.conf
8 if [ ! -e ${CONFIG} ];then
9     echo "File for MAC Address not found"
10     exit 1
11 fi
12 . $CONFIG
13
14 #default Value
15 SCRIPT=./qemu-ifup
16 HDA=./hda_5.raw
17
18 # qemu parameters
19 RAM=520;
20 TAP="tap,script=$SCRIPT";
21 #check for the creation of new HDA
22 if [ -e "$HDA" ]; then
23     echo "Disk already existing removing  it..."
24     rm -rf $HDA
25 fi
26
27 #Creating new HDA
28 echo "Creating hard disk for Qemu install under $HDA"
29
30 img=$(qemu-img create $HDA 10G)
31 if [ -z "$img" ];then
32         echo "Can't Create disk image..."
33         exit 1
34 fi
35
36 echo "New $HDA is created..."
37
38 #Command for running the Qemu Emulator
39 ARGS="-boot d -cdrom ${NODE_ISO} -hda ${HDA} -m ${RAM}  -net nic,macaddr=${MACADDR} -net $TAP -nographic";
40 echo "Running qemu $ARGS";
41 qemu $ARGS
42
43
44 exit