systemvmtemplate: Fix build.sh to export ova, vhd, qcow2 and vhd-hyperv Signed-off-by: Rohit Yadav <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a4ed061d Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a4ed061d Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a4ed061d Branch: refs/heads/qemu-img Commit: a4ed061dbfa5daec0208e2c3a84273c1e3f84a52 Parents: ab63a43 Author: Rohit Yadav <[email protected]> Authored: Mon Feb 18 18:51:17 2013 +0530 Committer: Rohit Yadav <[email protected]> Committed: Mon Feb 18 18:52:03 2013 +0530 ---------------------------------------------------------------------- tools/appliance/build.sh | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a4ed061d/tools/appliance/build.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh index cfd4e8b..ef3e384 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
