summaryrefslogtreecommitdiff
path: root/scripts/build-vmware-ovf
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build-vmware-ovf')
-rwxr-xr-xscripts/build-vmware-ovf8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/build-vmware-ovf b/scripts/build-vmware-ovf
index f3424a03..8890ba69 100755
--- a/scripts/build-vmware-ovf
+++ b/scripts/build-vmware-ovf
@@ -43,8 +43,12 @@ qemu-img convert -f raw ${source_image} -O vmdk -o adapter_type=lsilogic ${tmp_v
vmdk-convert ${tmp_vmdk} ${vmdk}
# Generate OVF
-vmdk_file_size=$(du --bytes ${vmdk} | awk '{print $1}')
-cat scripts/template.ovf | sed "s/{{vmdk_file_size}}/${vmdk_file_size}/" > ${ovf}
+vmdk_file_size=$(vmdk-convert -i ${vmdk} | jq .capacity)
+vmdk_populated_size=$(vmdk-convert -i ${vmdk} | jq .used)
+version=$(cat build/version)
+cat scripts/template.ovf | sed "s/{{vmdk_file_size}}/${vmdk_file_size}/" > ${ovf}
+sed -i "s/{{vmdk_populated_size}}/${vmdk_populated_size}/" ${ovf}
+sed -i "s/{{version}}/${version}/" ${ovf}
# Generate manifest file
cd ${DST_DIR}