4141# Get appliance uuids
4242machine_uuid=` vboxmanage showvminfo $appliance | grep UUID | head -1 | awk ' {print $2}' `
4343hdd_uuid=` vboxmanage showvminfo $appliance | grep vdi | head -1 | awk ' {print $8}' | cut -d ' )' -f 1`
44+ hdd_path=` vboxmanage list hdds | grep $appliance | grep vdi | cut -c 14-`
4445
4546# Compact the virtual hdd
4647vboxmanage modifyhd $hdd_uuid --compact
@@ -49,6 +50,19 @@ vboxmanage modifyhd $hdd_uuid --compact
4950rm -fr dist
5051mkdir dist
5152
53+ # Export for Xen
54+ vboxmange internalcommands converttoraw $hdd_path dist/raw.img
55+ vhd-util convert -s 0 -t 1 -i dist/raw.img -o dist/$appliance -$build_date -$branch -xen.vhd
56+ bzip2 dist/$appliance -$build_date -$branch -xen.vhd
57+ echo " $appliance exported for Xen: dist/$appliance -$build_date -$branch -xen.vhd.bz2"
58+
59+ # Export for KVM
60+ vboxmange internalcommands converttoraw $hdd_path dist/raw.img
61+ qemu-img convert -f raw -O qcow2 dist/raw.img dist/$appliance -$build_date -$branch -kvm.qcow2
62+ rm dist/raw.img
63+ bzip2 dist/$appliance -$build_date -$branch -kvm.qcow2
64+ echo " $appliance exported for KVM: dist/$appliance -$build_date -$branch -kvm.qcow2.bz2"
65+
5266# Export for VMWare vSphere
5367vboxmanage export $machine_uuid --output dist/$appliance -$build_date -$branch -vmware.ova
5468echo " $appliance exported for VMWare: dist/$appliance -$build_date -$branch -vmware.ova"
@@ -58,15 +72,3 @@ vboxmanage clonehd $hdd_uuid dist/$appliance-$build_date-$branch-hyperv.vhd --fo
5872bzip2 dist/$appliance -$build_date -$branch -hyperv.vhd
5973echo " $appliance exported for HyperV: dist/$appliance -$build_date -$branch -hyperv.vhd.bz2"
6074
61- # Export for KVM
62- vboxmanage clonehd $hdd_uuid dist/raw.img --format RAW
63- qemu-img convert -f raw -O qcow2 dist/raw.img dist/$appliance -$build_date -$branch -kvm.qcow2
64- bzip2 dist/$appliance -$build_date -$branch -kvm.qcow2
65- echo " $appliance exported for KVM: dist/$appliance -$build_date -$branch -kvm.qcow2.bz2"
66-
67- # Export for Xen
68- # This will be an overwrite convert so, do it at the end
69- vhd-util convert -s 0 -t 1 -i dist/raw.img -o dist/$appliance -$build_date -$branch -xen.vhd
70- bzip2 dist/$appliance -$build_date -$branch -xen.vhd
71- echo " $appliance exported for Xen: dist/$appliance -$build_date -$branch -xen.vhd.bz2"
72-
0 commit comments