Use parallel gzip in box creation if available

This can speed up box creation significantly on modern machines.
This commit is contained in:
Vratislav Podzimek 2019-05-09 13:27:04 +02:00
parent 0f037bab9b
commit 2f41402c9a

View File

@ -118,7 +118,12 @@ EOF
echo "==> Creating box, tarring and gzipping"
tar cvzf "$BOX" -S --totals ./metadata.json ./Vagrantfile ./box.img
if type pigz >/dev/null 2>/dev/null; then
GZ="pigz"
else
GZ="gzip"
fi
tar cv -S --totals ./metadata.json ./Vagrantfile ./box.img | $GZ -c > "$BOX"
# if box is in tmpdir move it to CWD before removing tmpdir
if ! isabspath "$BOX"; then