twoPhaseEulerFoam:frictionalStressModel/Schaeffer: Correct mut on processor boundaries
[OpenFOAM-1.7.x.git] / bin / foamPackSource
blobf143e2d6fb0bd0397b096b9187a802a935e3921f
1 #!/bin/sh
2 #---------------------------------*- sh -*-------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #------------------------------------------------------------------------------
9 # License
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
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your 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
20 # for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 # Script
26 # foamPackSource <directory> <tarFile>
28 # Description
29 # Packs and compresses the .C and .H files and Make/options
30 # and Make/files in a given directory.
32 #------------------------------------------------------------------------------
33 tmpFile=${TMPDIR:-/tmp}/foamPackFiles.$$
35 if [ $# -ne 2 ]
36 then
37 echo "Usage : ${0##*/} directory tarFile"
38 echo ""
39 echo "Packs all .C and .H files and Make/options and Make/files into"
40 echo "<tarFile>"
41 echo ""
42 exit 1
45 # canonical form (no double and no trailing dashes)
46 packDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@')
47 packFile=$2
49 if [ ! -d $packDir ]
50 then
51 echo "Error: directory $packDir does not exist"
52 exit 1
55 if [ -f $packFile ]
56 then
57 echo "Error: $packFile already exists"
58 exit 1
61 # Clean up on termination and on Ctrl-C
62 trap 'rm -f $tmpFile 2>/dev/null; exit 0' EXIT TERM INT
64 foamSourceFiles $packDir > $tmpFile
67 # provide some feedback
68 wc $tmpFile | awk '{print "Packing",$1,"files - this could take some time ..."}'
70 tar czpf $packFile --files-from $tmpFile
72 if [ $? -eq 0 ]
73 then
74 echo "Finished packing and compressing $packDir into file $packFile"
75 else
76 echo "Error: failure packing $packDir into file $packFile"
77 rm -f $packFile 2>/dev/null
80 #------------------------------------------------------------------------------