mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support bzip2 compression for foamPack*
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user