Add FoundationDB stuff
[slow/toolbox.git] / cvbox.sh
1 #!/bin/sh
2 if [ $# -eq 1 ] ; then
3     echo "Removing ISO image from \"$1\""
4     VBoxManage storageattach "$1" --storagectl IDE-Controller --port 1 --device 0 --type dvddrive --medium emptydrive
5     exit 0
6 fi
7
8 if [ $# -ne 2 ] ; then
9     echo "usage: $0 NAME [ABSOLUTE-PATH-TO-INSTALL-ISO-IMAGE]"
10     exit 1
11 fi
12
13 NAME="$1"
14 ISO="$2"
15
16 echo Creating VM \"$NAME\" with ISO image \"$ISO\" ...
17
18 echo VBoxManage -q createvm --name "$NAME" --register
19 VBoxManage -q createvm --name "$NAME" --register
20 if [ $? -ne 0 ] ; then echo "Error!" ; exit 1 ; fi
21
22 echo VBoxManage -q modifyvm "$NAME" --memory 1024 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 net0
23 VBoxManage -q modifyvm "$NAME" --memory 1024 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 net0
24 if [ $? -ne 0 ] ; then echo "Error!" ; exit 1 ; fi
25
26 echo VBoxManage -q createhd --filename "/mnt/daten/Daten/vbox/$NAME.vdi" --size 20000
27 VBoxManage -q createhd --filename "/mnt/daten/Daten/vbox/$NAME.vdi" --size 20000
28 if [ $? -ne 0 ] ; then echo "Error!" ; exit 1 ; fi
29
30 echo VBoxManage -q storagectl "$NAME" --name "IDE-Controller" --add ide
31 VBoxManage -q storagectl "$NAME" --name "IDE-Controller" --add ide
32 if [ $? -ne 0 ] ; then echo "Error!" ; exit 1 ; fi
33
34 echo VBoxManage -q storageattach "$NAME" --storagectl "IDE-Controller" --port 0 --device 0 --type hdd --medium "/mnt/daten/Daten/vbox/$NAME.vdi"
35 VBoxManage -q storageattach "$NAME" --storagectl "IDE-Controller" --port 0 --device 0 --type hdd --medium "/mnt/daten/Daten/vbox/$NAME.vdi"
36 if [ $? -ne 0 ] ; then echo "Error!" ; exit 1 ; fi
37
38 echo VBoxManage -q storageattach "$NAME" --storagectl "IDE-Controller" --port 1 --device 0 --type dvddrive --medium "$ISO"
39 VBoxManage -q storageattach "$NAME" --storagectl "IDE-Controller" --port 1 --device 0 --type dvddrive --medium "$ISO"
40 if [ $? -ne 0 ] ; then echo "Error!" ; exit 1 ; fi
41
42 echo Done.