ENH: support bzip2 compression for foamPack*

This commit is contained in:
Mark Olesen
2011-02-15 11:04:08 +01:00
parent 449a0e253d
commit dd22de68d4
6 changed files with 88 additions and 10 deletions

View File

@ -59,6 +59,7 @@ cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] <archOptions>
${0##*/} [OPTION] -current
options:
-b, -bzip2 use bzip2 instead of gzip compression
-c, -current use current value of \$WM_OPTIONS
-o, -output <dir> specify alternative output directory
@ -73,6 +74,7 @@ USAGE
unset archOptions outputDir
packExt=tgz
# parse options
while [ "$#" -gt 0 ]
@ -81,6 +83,10 @@ do
-h | -help)
usage
;;
-b | -bzip2)
packExt=tbz
shift
;;
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
archOptions="$WM_OPTIONS"
shift
@ -110,7 +116,6 @@ fi
#------------------------------------------------------------------------------
timeStamp=$(date +%Y-%m-%d)
packExt=tgz
packBase=${packDir}.${archOptions}_${timeStamp}
# add optional output directory
@ -137,11 +142,20 @@ else
exit 1
fi
# bzip2 or gzip compression
case "$packFile" in
*tbz)
tarOpt=cpjf
;;
*)
tarOpt=cpzf
;;
esac
# Clean up on Ctrl-C
trap 'rm -f $packFile 2>/dev/null' INT
tar cpzf $packFile $dirList
tar $tarOpt $packFile $dirList
if [ $? -eq 0 ]
then
echo "Finished packing file $packFile" 1>&2