1616# under the License.
1717
1818set -x
19+ set -e
1920
2021appliance=" systemvmtemplate"
2122build_date=` date +%Y-%m-%d`
@@ -30,9 +31,15 @@ veewee vbox destroy $appliance
3031veewee vbox build $appliance --nogui
3132veewee vbox halt $appliance
3233
34+ while [[ ` vboxmanage list runningvms | grep $appliance | wc -l` -ne 0 ]];
35+ do
36+ echo " Waiting for $appliance to shutdown"
37+ sleep 2;
38+ done
39+
3340# Get appliance uuids
3441machine_uuid=` vboxmanage showvminfo $appliance | grep UUID | head -1 | awk ' {print $2}' `
35- hdd_uuid=` vboxmanage showvminfo $appliance | grep vhd | head -1 | awk ' {print $8}' | cut -d ' )' -f 1`
42+ hdd_uuid=` vboxmanage showvminfo $appliance | grep vmdk | head -1 | awk ' {print $8}' | cut -d ' )' -f 1`
3643
3744# Start exporting
3845rm -fr dist
@@ -45,18 +52,15 @@ vboxmanage export $machine_uuid --output $appliance-$build_date-$branch-vmware.o
4552# Export for HyperV
4653vboxmanage clonehd $hdd_uuid $appliance -$build_date -$branch -hyperv.vhd --format VHD
4754bzip2 $appliance -$build_date -$branch -hyperv.vhd
48- rm $appliance -$build_date -$branch -hyperv.vhd
4955
5056# Export for KVM
5157vboxmanage clonehd $hdd_uuid raw.img --format RAW
5258qemu-img convert -f raw -O qcow2 raw.img $appliance -$build_date -$branch -kvm.qcow2
5359bzip2 $appliance -$build_date -$branch -kvm.qcow2
54- rm $appliance -$build_date -$branch -kvm.qcow2
5560
5661# Export for Xen
5762# This will be an overwrite convert so, do it at the end
5863vhd-util convert -s 0 -t 1 -i raw.img -o $appliance -$build_date -$branch -xen.vhd
59- bzip2 $appliance -$build_date -$branch -hyperv.vhd
60- rm $appliance -$build_date -$branch -hyperv.vhd
64+ bzip2 $appliance -$build_date -$branch -xen.vhd
6165
6266cd $rootdir
0 commit comments