From a4ed061dbfa5daec0208e2c3a84273c1e3f84a52 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Mon, 18 Feb 2013 18:51:17 +0530 Subject: [PATCH] systemvmtemplate: Fix build.sh to export ova, vhd, qcow2 and vhd-hyperv Signed-off-by: Rohit Yadav --- tools/appliance/build.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh index cfd4e8b2349..ef3e384b597 100644 --- a/tools/appliance/build.sh +++ b/tools/appliance/build.sh @@ -18,6 +18,9 @@ set -x appliance="systemvmtemplate" +build_date=`date +%Y-%m-%d` +branch="master" +rootdir=$PWD # Initialize veewee and dependencies bundle @@ -25,3 +28,34 @@ bundle # Start building the appliance veewee vbox build $appliance --nogui veewee vbox halt $appliance + +# Get appliance uuids +machine_uuid=`vboxmanage showvminfo $appliance | grep UUID | head -1 | awk '{print $2}'` +hdd_uuid=`vboxmanage showvminfo $appliance | grep vhd | head -1 | awk '{print $8}' | cut -d ')' -f 1` + +# Start exporting +rm -fr dist +mkdir dist +cd dist + +# Export for VMWare vSphere +vboxmanage export $machine_uuid --output $appliance-$build_date-$branch-vmware.ova + +# Export for HyperV +vboxmanage clonehd $hdd_uuid $appliance-$build_date-$branch-hyperv.vhd --format VHD +bzip2 $appliance-$build_date-$branch-hyperv.vhd +rm $appliance-$build_date-$branch-hyperv.vhd + +# Export for KVM +vboxmanage clonehd $hdd_uuid raw.img --format RAW +qemu-img convert -f raw -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2 +bzip2 $appliance-$build_date-$branch-kvm.qcow2 +rm $appliance-$build_date-$branch-kvm.qcow2 + +# Export for Xen +# This will be an overwrite convert so, do it at the end +vhd-util convert -s 0 -t 1 -i raw.img -o $appliance-$build_date-$branch-xen.vhd +bzip2 $appliance-$build_date-$branch-hyperv.vhd +rm $appliance-$build_date-$branch-hyperv.vhd + +cd $rootdir