diff --git a/bin/disk-image-create b/bin/disk-image-create index 943cf6c6d..eee85c011 100755 --- a/bin/disk-image-create +++ b/bin/disk-image-create @@ -102,7 +102,7 @@ function show_options () { echo "Options:" echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)" echo " -o imagename -- set the imagename of the output image file(default image)" - echo " -t qcow2,tar,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)" + echo " -t qcow2,tar,tgz,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)" echo " File types should be comma separated. VHD outputting requires the vhd-util" echo " executable be in your PATH. ACI outputting requires the ACI_MANIFEST " echo " environment variable be a path to a manifest file." @@ -258,6 +258,10 @@ for X in ${!IMAGE_TYPES[@]}; do exit 1 fi ;; + tgz) + # Force tar to be created. + IMAGE_TYPES+=('tar') + ;; vhd) if [ -z "$(which vhd-util)" ]; then echo "vhd output format specified but no vhd-util executable found." diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst index 16dccc110..a401a96f6 100644 --- a/doc/source/user_guide/building_an_image.rst +++ b/doc/source/user_guide/building_an_image.rst @@ -51,6 +51,7 @@ formats are: * qcow2 * tar + * tgz * vhd * docker * raw diff --git a/lib/img-functions b/lib/img-functions index f64a95a53..6ba0dfe45 100644 --- a/lib/img-functions +++ b/lib/img-functions @@ -122,6 +122,9 @@ function compress_and_save_image () { fi if [ "$IMAGE_TYPE" = "raw" ]; then mv $TMP_IMAGE_PATH $1-new + elif [ "$IMAGE_TYPE" == "tgz" ]; then + gzip -9 < $IMAGE_NAME.tar > $1-new + rm $IMAGE_NAME.tar elif [ "$IMAGE_TYPE" == "vhd" ]; then cp $TMP_IMAGE_PATH $1-intermediate vhd-util convert -s 0 -t 1 -i $1-intermediate -o $1-intermediate diff --git a/tests/run_output_format_test.sh b/tests/run_output_format_test.sh index b2f435ad4..6d0f21c7f 100755 --- a/tests/run_output_format_test.sh +++ b/tests/run_output_format_test.sh @@ -59,7 +59,7 @@ function build_test_image() { fi } -test_formats="tar raw qcow2 docker aci" +test_formats="tar tgz raw qcow2 docker aci" for binary in qemu-img docker ; do if [ -z "$(which $binary)" ]; then echo "Warning: No $binary binary found, cowardly refusing to run tests."