diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index 3d3996d7..1de310cb 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -123,6 +123,7 @@ DIB_DEBUG_TRACE=${DIB_DEBUG_TRACE:-0} INSTALL_PACKAGES="" IMAGE_TYPES=("qcow2") COMPRESS_IMAGE="true" +DIB_GZIP_BIN=${DIB_GZIP_BIN:-"gzip"} ROOT_LABEL="" DIB_DEFAULT_INSTALLTYPE=${DIB_DEFAULT_INSTALLTYPE:-"source"} MKFS_OPTS="" diff --git a/diskimage_builder/lib/img-functions b/diskimage_builder/lib/img-functions index f158ee95..fa75d7c9 100644 --- a/diskimage_builder/lib/img-functions +++ b/diskimage_builder/lib/img-functions @@ -144,7 +144,7 @@ function compress_and_save_image () { if [ "$IMAGE_TYPE" = "raw" ]; then mv $TMP_IMAGE_PATH $1-new elif [ "$IMAGE_TYPE" == "tgz" ]; then - gzip -9 < $IMAGE_NAME.tar > $1-new + $DIB_GZIP_BIN -9 < $IMAGE_NAME.tar > $1-new rm $IMAGE_NAME.tar elif [ "$IMAGE_TYPE" == "vhd" ]; then cp $TMP_IMAGE_PATH $1-intermediate diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst index 14aaee9e..67de29ef 100644 --- a/doc/source/user_guide/building_an_image.rst +++ b/doc/source/user_guide/building_an_image.rst @@ -57,6 +57,9 @@ formats are: * docker * raw +When building a tgz image, note that the `DIB_GZIP_BIN` environment variable +can be used to set the path of the gzip executable. + Disk Image Layout ----------------- diff --git a/releasenotes/notes/gzip-env-variable-94e61e0c043f4f1f.yaml b/releasenotes/notes/gzip-env-variable-94e61e0c043f4f1f.yaml new file mode 100644 index 00000000..97e0c653 --- /dev/null +++ b/releasenotes/notes/gzip-env-variable-94e61e0c043f4f1f.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The `DIB_GZIP_BIN` environment variable enables builders to change the + path to `gzip`, such as when an alternate gzip is to be used (ie. pigz).