From 29c39e8f4eae8b6eca61669f4b85429a236a78b0 Mon Sep 17 00:00:00 2001 From: Hiroaki KAWAI Date: Thu, 27 Jun 2013 13:04:12 +0900 Subject: [PATCH] Add check for some cli programs Add check for faketime and vhd-util for xen export. --- tools/appliance/build.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh index b546c3f8f55..f9a5b592699 100644 --- a/tools/appliance/build.sh +++ b/tools/appliance/build.sh @@ -63,17 +63,24 @@ vboxmanage modifyhd $hdd_uuid --compact rm -fr dist *.ova *.vhd *.vdi *.qcow* *.bz2 mkdir dist +# Export for Xen +which faketime >/dev/null 2>&1 && which vhd-util >/dev/null 2>&1 +if [ $? == 0 ]; then + set -e + vboxmanage internalcommands converttoraw -format vdi "$hdd_path" img.raw + faketime '2010-01-01' vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd + faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o $appliance-$build_date-$branch-xen.vhd + rm *.bak + bzip2 $appliance-$build_date-$branch-xen.vhd + echo "$appliance exported for Xen: dist/$appliance-$build_date-$branch-xen.vhd.bz2" +else + echo "** Skipping $appliance export for Xen: faketime or vhd-util command is missing. **" + echo "** faketime source code is available from https://github.com/wolfcw/libfaketime **" +fi + # Exit shell if exporting fails for any format set -e -# Export for Xen -vboxmanage internalcommands converttoraw -format vdi "$hdd_path" img.raw -faketime '2010-01-01' vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd -faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o $appliance-$build_date-$branch-xen.vhd -rm *.bak -bzip2 $appliance-$build_date-$branch-xen.vhd -echo "$appliance exported for Xen: dist/$appliance-$build_date-$branch-xen.vhd.bz2" - # Export for KVM vboxmanage internalcommands converttoraw -format vdi "$hdd_path" raw.img qemu-img convert -f raw -c -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2