diff --git a/create b/create index 67a91fb..4118f2d 100755 --- a/create +++ b/create @@ -25,7 +25,30 @@ debug set -x case "$IMAGE_TYPE" in tarball) - IMG_EXT=".tar.gz" + case $TARBALL_COMPRESS in + none) + IMG_EXT=".tar" + ;; + gzip|pigz) + IMG_EXT=".tar.gz" + ;; + bzip2|pbzip2|lbzip2) + IMG_EXT=".tar.bz2" + ;; + lzop) + IMG_EXT=".tar.lzo" + ;; + xz) + IMG_EXT=".tar.xz" + ;; + p7zip) + IMG_EXT=".tar.7z" + ;; + *) + log_error "$TARBALL_COMPRESS as tarball compressor is not supported" + exit 1 + ;; + esac ;; qemu) IMG_EXT=".img" @@ -134,7 +157,7 @@ if [ "$CDINSTALL" = "no" ] ; then if [ "${IMAGE_TYPE}" = "tarball" ] ; then # unpack image - tar pzxf $IMAGE_FILE -C $TARGET + tar -I"$TARBALL_COMPRESS" -pxf $IMAGE_FILE -C $TARGET elif [ "${IMAGE_TYPE}" = "dump" ] ; then root_dump="${IMAGE_FILE}" ( cd ${TARGET}; restore -r -y -f ${root_dump} > /dev/null ) diff --git a/defaults b/defaults index 52bbd46..ecdc6cd 100644 --- a/defaults +++ b/defaults @@ -40,6 +40,13 @@ # ( default is @localstatedir@/cache/ganeti-instance-image ) # IMAGE_DIR="" +# TARBALL_COMPRESS: compress program use to compress tar file. +# It must accept the -d option, for decompression. +# The argument can contain command line options. +# Use either none, gzip, pigz, bzip2, pzip2, lbzip2, lzop, xz, p7zip +# (default is gzip) +# TARBALL_COMPRESS="gzip" + # NOMOUNT: Do not try to mount volume (if it is not a linux partition). Accepts # either 'yes' or 'no'. This option is useful for installing Windows images for # example. ( default is no )