Skip to content

Commit a4ed061

Browse files
committed
systemvmtemplate: Fix build.sh to export ova, vhd, qcow2 and vhd-hyperv
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
1 parent ab63a43 commit a4ed061

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎tools/appliance/build.sh‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,44 @@
1818
set -x
1919

2020
appliance="systemvmtemplate"
21+
build_date=`date +%Y-%m-%d`
22+
branch="master"
23+
rootdir=$PWD
2124

2225
# Initialize veewee and dependencies
2326
bundle
2427

2528
# Start building the appliance
2629
veewee vbox build $appliance --nogui
2730
veewee vbox halt $appliance
31+
32+
# Get appliance uuids
33+
machine_uuid=`vboxmanage showvminfo $appliance | grep UUID | head -1 | awk '{print $2}'`
34+
hdd_uuid=`vboxmanage showvminfo $appliance | grep vhd | head -1 | awk '{print $8}' | cut -d ')' -f 1`
35+
36+
# Start exporting
37+
rm -fr dist
38+
mkdir dist
39+
cd dist
40+
41+
# Export for VMWare vSphere
42+
vboxmanage export $machine_uuid --output $appliance-$build_date-$branch-vmware.ova
43+
44+
# Export for HyperV
45+
vboxmanage clonehd $hdd_uuid $appliance-$build_date-$branch-hyperv.vhd --format VHD
46+
bzip2 $appliance-$build_date-$branch-hyperv.vhd
47+
rm $appliance-$build_date-$branch-hyperv.vhd
48+
49+
# Export for KVM
50+
vboxmanage clonehd $hdd_uuid raw.img --format RAW
51+
qemu-img convert -f raw -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2
52+
bzip2 $appliance-$build_date-$branch-kvm.qcow2
53+
rm $appliance-$build_date-$branch-kvm.qcow2
54+
55+
# Export for Xen
56+
# This will be an overwrite convert so, do it at the end
57+
vhd-util convert -s 0 -t 1 -i raw.img -o $appliance-$build_date-$branch-xen.vhd
58+
bzip2 $appliance-$build_date-$branch-hyperv.vhd
59+
rm $appliance-$build_date-$branch-hyperv.vhd
60+
61+
cd $rootdir

0 commit comments

Comments
 (0)