Add output image format tgz support

We now support tgz (tar.gz) as an output format.

Change-Id: Iadec92f2f96c3f904f28bd49f87ffc7d48ef7bd7
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-12-17 16:41:14 -05:00
parent 6d82543682
commit da41ee6012
4 changed files with 10 additions and 2 deletions

View File

@ -102,7 +102,7 @@ function show_options () {
echo "Options:" echo "Options:"
echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)" 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 " -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 " 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 " executable be in your PATH. ACI outputting requires the ACI_MANIFEST "
echo " environment variable be a path to a manifest file." echo " environment variable be a path to a manifest file."
@ -258,6 +258,10 @@ for X in ${!IMAGE_TYPES[@]}; do
exit 1 exit 1
fi fi
;; ;;
tgz)
# Force tar to be created.
IMAGE_TYPES+=('tar')
;;
vhd) vhd)
if [ -z "$(which vhd-util)" ]; then if [ -z "$(which vhd-util)" ]; then
echo "vhd output format specified but no vhd-util executable found." echo "vhd output format specified but no vhd-util executable found."

View File

@ -51,6 +51,7 @@ formats are:
* qcow2 * qcow2
* tar * tar
* tgz
* vhd * vhd
* docker * docker
* raw * raw

View File

@ -122,6 +122,9 @@ function compress_and_save_image () {
fi fi
if [ "$IMAGE_TYPE" = "raw" ]; then if [ "$IMAGE_TYPE" = "raw" ]; then
mv $TMP_IMAGE_PATH $1-new 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 elif [ "$IMAGE_TYPE" == "vhd" ]; then
cp $TMP_IMAGE_PATH $1-intermediate cp $TMP_IMAGE_PATH $1-intermediate
vhd-util convert -s 0 -t 1 -i $1-intermediate -o $1-intermediate vhd-util convert -s 0 -t 1 -i $1-intermediate -o $1-intermediate

View File

@ -59,7 +59,7 @@ function build_test_image() {
fi fi
} }
test_formats="tar raw qcow2 docker aci" test_formats="tar tgz raw qcow2 docker aci"
for binary in qemu-img docker ; do for binary in qemu-img docker ; do
if [ -z "$(which $binary)" ]; then if [ -z "$(which $binary)" ]; then
echo "Warning: No $binary binary found, cowardly refusing to run tests." echo "Warning: No $binary binary found, cowardly refusing to run tests."