tools/create_box.sh in vagrant-libvirt-0.0.37 vs tools/create_box.sh in vagrant-libvirt-0.0.38
- old
+ new
@@ -86,11 +86,11 @@
cd "$TMP_DIR"
#Using the awk int function here to truncate the virtual image size to an
#integer since the fog-libvirt library does not seem to properly handle
#floating point.
-IMG_SIZE=$(qemu-img info "$TMP_IMG" | awk '/virtual size/{print int($3)+1;}' | tr -d 'G')
+IMG_SIZE=$(qemu-img info --output=json "$TMP_IMG" | awk '/virtual-size/{s=int($2)/(1024^3); print (s == int(s)) ? s : int(s)+1 }')
echo "{$IMG_SIZE}"
cat > metadata.json <<EOF
{
@@ -116,10 +116,10 @@
end
EOF
echo "==> Creating box, tarring and gzipping"
-tar cvzf "$BOX" --totals ./metadata.json ./Vagrantfile ./box.img
+tar cvzf "$BOX" -S --totals ./metadata.json ./Vagrantfile ./box.img
# if box is in tmpdir move it to CWD before removing tmpdir
if ! isabspath "$BOX"; then
mv "$BOX" "$CWD"
fi