Add check for some cli programs

Add check for faketime and vhd-util for xen export.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/29c39e8f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/29c39e8f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/29c39e8f

Branch: refs/heads/vmsync
Commit: 29c39e8f4eae8b6eca61669f4b85429a236a78b0
Parents: de44a77
Author: Hiroaki KAWAI <ka...@stratosphere.co.jp>
Authored: Thu Jun 27 13:04:12 2013 +0900
Committer: Hiroaki KAWAI <ka...@stratosphere.co.jp>
Committed: Thu Jun 27 13:04:12 2013 +0900

----------------------------------------------------------------------
 tools/appliance/build.sh | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/29c39e8f/tools/appliance/build.sh
----------------------------------------------------------------------
diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh
index b546c3f..f9a5b59 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

Reply via email to