2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
8 #-------------------------------------------------------------------------------
10 # This file is part of OpenFOAM.
12 # OpenFOAM is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation; either version 2 of the License, or (at your
15 # option) any later version.
17 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
18 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM; if not, write to the Free Software Foundation,
24 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 # foamPackSource <directory> <tarFile>
30 # Packs and compresses the .C and .H files and Make/options
31 # and Make/files in a given directory.
33 #------------------------------------------------------------------------------
34 tmpFile
=${TMPDIR:-/tmp}/foamPackFiles.$$
38 echo "Usage : ${0##*/} directory tarFile"
40 echo "Packs all .C and .H files and Make/options and Make/files into"
46 # canonical form (no double and no trailing dashes)
47 packDir
=$
(echo "$1" |
sed -e 's@//*@/@g' -e 's@/$@@')
52 echo "Error: directory $packDir does not exist"
58 echo "Error: $packFile already exists"
62 # Clean up on termination and on Ctrl-C
63 trap 'rm -f $tmpFile 2>/dev/null; exit 0' EXIT TERM INT
67 \
( -type f
-o -type l \
) \
77 -a ! -name "core.[1-9]*" \
78 -a ! -name "log[0-9]*" \
79 -a ! -name "libccmio*" \
81 -e "\@$packDir/lib/@d" \
84 -e '\@applications/bin/@d' \
87 -e '\@/Make[.A-Za-z]*/[^/]*/@d'\
88 -e '\@/platforms/@d' \
89 -e '\@libccmio.*/@d' \
93 # provide some feedback
94 wc $tmpFile |
awk '{print "Packing",$1,"files - this could take some time ..."}'
96 tar czpf
$packFile --files-from $tmpFile
100 echo "Finished packing and compressing $packDir into file $packFile"
102 echo "Error: failure packing $packDir into file $packFile"
103 rm -f $packFile 2>/dev
/null
106 #------------------------------------------------------------------------------