Skip to content

Commit 29c39e8

Browse files
committed
Add check for some cli programs
Add check for faketime and vhd-util for xen export.
1 parent de44a77 commit 29c39e8

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

‎tools/appliance/build.sh‎

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,24 @@ vboxmanage modifyhd $hdd_uuid --compact
6363
rm -fr dist *.ova *.vhd *.vdi *.qcow* *.bz2
6464
mkdir dist
6565

66+
# Export for Xen
67+
which faketime >/dev/null 2>&1 && which vhd-util >/dev/null 2>&1
68+
if [ $? == 0 ]; then
69+
set -e
70+
vboxmanage internalcommands converttoraw -format vdi "$hdd_path" img.raw
71+
faketime '2010-01-01' vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd
72+
faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o $appliance-$build_date-$branch-xen.vhd
73+
rm *.bak
74+
bzip2 $appliance-$build_date-$branch-xen.vhd
75+
echo "$appliance exported for Xen: dist/$appliance-$build_date-$branch-xen.vhd.bz2"
76+
else
77+
echo "** Skipping $appliance export for Xen: faketime or vhd-util command is missing. **"
78+
echo "** faketime source code is available from https://github.com/wolfcw/libfaketime **"
79+
fi
80+
6681
# Exit shell if exporting fails for any format
6782
set -e
6883

69-
# Export for Xen
70-
vboxmanage internalcommands converttoraw -format vdi "$hdd_path" img.raw
71-
faketime '2010-01-01' vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd
72-
faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o $appliance-$build_date-$branch-xen.vhd
73-
rm *.bak
74-
bzip2 $appliance-$build_date-$branch-xen.vhd
75-
echo "$appliance exported for Xen: dist/$appliance-$build_date-$branch-xen.vhd.bz2"
76-
7784
# Export for KVM
7885
vboxmanage internalcommands converttoraw -format vdi "$hdd_path" raw.img
7986
qemu-img convert -f raw -c -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2

0 commit comments

Comments
 (0)