From d3505ba860d05e1354362d45be470ddf7445f28a Mon Sep 17 00:00:00 2001 From: Urs Schulz Date: Wed, 2 May 2018 15:51:54 +0200 Subject: [PATCH] mkplatformfs.sh: add option to disable compression --- mkplatformfs.sh.in | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/mkplatformfs.sh.in b/mkplatformfs.sh.in index 546b5f5..553b068 100644 --- a/mkplatformfs.sh.in +++ b/mkplatformfs.sh.in @@ -61,6 +61,7 @@ Options -C Full path to the XBPS configuration file -r Set XBPS repository (may be set multiple times) -x Use threads to compress the image (dynamic if unset) + -n Do not compress the image, instead print out the rootfs directory -h Show this help -V Show version _EOF @@ -71,8 +72,9 @@ _EOF # ######################################## BASEPKG=base-system +COMPRESSION="y" -while getopts "b:p:k:c:C:r:x:hV" opt; do +while getopts "b:p:k:c:C:r:x:nhV" opt; do case $opt in b) BASEPKG="$OPTARG" ;; p) EXTRA_PKGS="$OPTARG" ;; @@ -81,6 +83,7 @@ while getopts "b:p:k:c:C:r:x:hV" opt; do C) XBPS_CONFFILE="-C $OPTARG" ;; r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG" ;; x) COMPRESSOR_THREADS="$OPTARG" ;; + n) COMPRESSION="n" ;; h) usage; exit 0 ;; V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0 ;; esac @@ -207,17 +210,23 @@ cleanup_chroot # only for it to be out of date, we remove it now. rm -rf "$ROOTFS/var/cache/*" 2>/dev/null -# Finally we can compress the tarball, the name will include the -# platform and the date on which the tarball was built. -tarball=void-${PLATFORM}-PLATFORMFS-$(date '+%Y%m%d').tar.xz -run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball " +# Compress the tarball or just print out the path? +if [ "$COMPRESSION" = "y" ]; then + # Finally we can compress the tarball, the name will include the + # platform and the date on which the tarball was built. + tarball=void-${PLATFORM}-PLATFORMFS-$(date '+%Y%m%d').tar.xz + run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball " -# Now that we have the tarball we don't need the rootfs anymore, so we -# can get rid of it. -rm -rf "$ROOTFS" + # Now that we have the tarball we don't need the rootfs anymore, so we + # can get rid of it. + rm -rf "$ROOTFS" -# Last thing to do before closing out is to let the user know that -# this succeeded. This also ensures that there's something visible -# that the user can look for at the end of the script, which can make -# it easier to see what's going on if something above failed. -info_msg "Successfully created $tarball ($PLATFORM)" + # Last thing to do before closing out is to let the user know that + # this succeeded. This also ensures that there's something visible + # that the user can look for at the end of the script, which can make + # it easier to see what's going on if something above failed. + info_msg "Successfully created $tarball ($PLATFORM)" +else + # User requested just printing out the path to the rootfs, here it comes. + info_msg "Successfully created rootfs under $ROOTFS" +fi