Add check for some cli programs

Add check for faketime and vhd-util for xen export.
This commit is contained in:
Hiroaki KAWAI 2013-06-27 13:04:12 +09:00
parent de44a77878
commit 29c39e8f4e

View File

@ -63,17 +63,24 @@ vboxmanage modifyhd $hdd_uuid --compact
rm -fr dist *.ova *.vhd *.vdi *.qcow* *.bz2 rm -fr dist *.ova *.vhd *.vdi *.qcow* *.bz2
mkdir dist 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 # Exit shell if exporting fails for any format
set -e 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 # Export for KVM
vboxmanage internalcommands converttoraw -format vdi "$hdd_path" raw.img 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 qemu-img convert -f raw -c -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2