Add -c option with defaults to 'auto' thats autodetect current compression type of squashfs images to be processed. Add a note about supported status in Linux versions. Needs squashfs-tools-4.1 (now on extra). Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> --- archiso2dual/archiso2dual | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/archiso2dual/archiso2dual b/archiso2dual/archiso2dual index 5b17b4a..f34f078 100755 --- a/archiso2dual/archiso2dual +++ b/archiso2dual/archiso2dual @@ -19,6 +19,7 @@ work_dir="/tmp/archiso2dual" isomounts_file="/usr/share/archiso2dual/isomounts" syslinuxcfg_file="/usr/share/archiso2dual/syslinux.cfg" removefiles_file="/usr/share/archiso2dual/removefiles.lst" +compression="auto" appname=${0##*/} _error="0" _confirm="n" @@ -111,11 +112,16 @@ mksquashfs_image() { echo "Executing: ${FUNCNAME}" img=${1} arch=${2} + if [ "${compression}" = "auto" ]; then + _compression=$(unsquashfs -s ${work_dir}/iso/${arch}/${img}.sqfs | awk '/^Compression/ { print $2 }') + else + _compression=${compression} + fi rm -f ${work_dir}/iso/${arch}/${img}.sqfs if [ "${quiet}" = "y" ]; then - mksquashfs ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${arch}/${img}.sqfs > /dev/null + mksquashfs ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${arch}/${img}.sqfs -comp ${_compression} > /dev/null else - mksquashfs ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${arch}/${img}.sqfs + mksquashfs ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${arch}/${img}.sqfs -comp ${_compression} fi } @@ -239,6 +245,12 @@ show_help() (default to '${publisher}')" echo " -A <application> Set an application name for the disk (default to '${application}')" + echo " -c <compressor> Set SquashFS compression type: auto, gzip, lzma or lzo + (default to '${compression}')" + echo " NOTES:" + echo " lzma: not officially supported yet by Linux (2.6.36)" + echo " lzo: needs Linux >= 2.6.36" + echo " -y Confirm execution (otherwise only show configuration)" echo " -v Enable verbose output" echo " -h This message" @@ -334,7 +346,7 @@ if [ "$EUID" != "0" ]; then exit 1 fi -while getopts '3:6:o:T:M:S:R:L:P:A:yvh' arg; do +while getopts '3:6:o:T:M:S:R:L:P:A:c:yvh' arg; do case "${arg}" in 3) isofile_i686="${OPTARG}" ;; 6) isofile_x86_64="${OPTARG}" ;; @@ -350,6 +362,7 @@ while getopts '3:6:o:T:M:S:R:L:P:A:yvh' arg; do L) label="${OPTARG}" ;; P) publisher="${OPTARG}" ;; A) application="${OPTARG}" ;; + c) compression="${OPTARG}" ;; w) work_dir="${OPTARG}" ;; y) _confirm="y" ;; v) quiet="n"; _v="-v" ;; -- 1.7.3.1