From 2b4cb23df745f61cd108cfd6c7fb83b1029331cb Mon Sep 17 00:00:00 2001 From: zen2 Date: Wed, 21 Sep 2016 19:59:10 +0200 Subject: [PATCH 1/4] Add several compress_program to tarball image type Adding none, gz, bz2, lzo, xz, 7z compression type to tarball image type. --- create | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/create b/create index 67a91fb..f5f38ce 100755 --- a/create +++ b/create @@ -25,7 +25,30 @@ debug set -x case "$IMAGE_TYPE" in tarball) - IMG_EXT=".tar.gz" + case $IMAGE_TARBALL_COMPRESS in + none) + TARBALL_EXTENSION=".tar" + ;; + gzip|pigz) + TARBALL_EXTENSION=".tar.gz" + ;; + bzip2|pbzip2|lbzip2) + TARBALL_EXTENSION=".tar.bz2" + ;; + lzop) + TARBALL_EXTENSION=".tar.lzo" + ;; + xz) + TARBALL_EXTENSION=".tar.xz" + ;; + p7zip) + TARBALL_EXTENSION=".tar.7z" + ;; + *) + log_error "$IMAGE_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"$IMAGE_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 ) From c156ae95ca9a246bc14999a6632a62997608c69d Mon Sep 17 00:00:00 2001 From: zen2 Date: Wed, 21 Sep 2016 20:12:00 +0200 Subject: [PATCH 2/4] adding IMAGE_TARBALL_COMPRESS parameter with description --- defaults | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/defaults b/defaults index 52bbd46..43ff95c 100644 --- a/defaults +++ b/defaults @@ -40,6 +40,13 @@ # ( default is @localstatedir@/cache/ganeti-instance-image ) # IMAGE_DIR="" +# IMAGE_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) +# IMAGE_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 ) From 4a7c71424e2ab6dc2669a3b606c662bf0266cb8d Mon Sep 17 00:00:00 2001 From: zen2 Date: Wed, 21 Sep 2016 20:21:33 +0200 Subject: [PATCH 3/4] use IMG_EXT for all TARBALL_COMPRESS type for consistency --- create | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/create b/create index f5f38ce..4118f2d 100755 --- a/create +++ b/create @@ -25,27 +25,27 @@ debug set -x case "$IMAGE_TYPE" in tarball) - case $IMAGE_TARBALL_COMPRESS in + case $TARBALL_COMPRESS in none) - TARBALL_EXTENSION=".tar" + IMG_EXT=".tar" ;; gzip|pigz) - TARBALL_EXTENSION=".tar.gz" + IMG_EXT=".tar.gz" ;; bzip2|pbzip2|lbzip2) - TARBALL_EXTENSION=".tar.bz2" + IMG_EXT=".tar.bz2" ;; lzop) - TARBALL_EXTENSION=".tar.lzo" + IMG_EXT=".tar.lzo" ;; xz) - TARBALL_EXTENSION=".tar.xz" + IMG_EXT=".tar.xz" ;; p7zip) - TARBALL_EXTENSION=".tar.7z" + IMG_EXT=".tar.7z" ;; *) - log_error "$IMAGE_TARBALL_COMPRESS as tarball compressor is not supported" + log_error "$TARBALL_COMPRESS as tarball compressor is not supported" exit 1 ;; esac @@ -157,7 +157,7 @@ if [ "$CDINSTALL" = "no" ] ; then if [ "${IMAGE_TYPE}" = "tarball" ] ; then # unpack image - tar -I"$IMAGE_TARBALL_COMPRESS" -pxf $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 ) From 07816ff2694e98305955a1fc407cfe35df05aebb Mon Sep 17 00:00:00 2001 From: zen2 Date: Wed, 21 Sep 2016 20:22:34 +0200 Subject: [PATCH 4/4] IMAGE_TARBALL_COMPRESS -> TARBALL_COMPRESS --- defaults | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/defaults b/defaults index 43ff95c..ecdc6cd 100644 --- a/defaults +++ b/defaults @@ -40,12 +40,12 @@ # ( default is @localstatedir@/cache/ganeti-instance-image ) # IMAGE_DIR="" -# IMAGE_TARBALL_COMPRESS: compress program use to compress tar file. +# 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) -# IMAGE_TARBALL_COMPRESS="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