Newer
Older
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 4.1
# \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------
# foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# foamPack [outputDir]
#
# Description
# Packs and compresses the foam directory for release
#
#------------------------------------------------------------------------------
tmpFile=${TMPDIR:-/tmp}/foamPackFiles.$$
timeStamp=$(date +%Y-%m-%d)
packDir=$WM_PROJECT-$WM_PROJECT_VERSION
packFile=${packDir}_${timeStamp}.tgz
if [ ! -d $packDir ]
then
fi
# add optional output directory
fi
if [ -f $packFile ]
then
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
fi
# Create time stamp file
# ~~~~~~~~~~~~~~~~~~~~~~
echo $timeStamp 2>/dev/null > $packDir/.timeStamp
# Clean up on termination and on Ctrl-C
trap 'rm -f $tmpFile 2>/dev/null; exit 0' EXIT TERM INT
# Pack and compress the packFile using GNU tar
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo
echo "Packing foam version $packDir into $packFile"
echo
echo "finding and packing"
find -H $packDir \
! -type d -type f \
! -name "*~" \
-a ! -name ".*~" \
-a ! -name "*.orig" \
-a ! -name "*.dep" \
-a ! -name "*.o" \
-a ! -name "*.so" \
-a ! -name "*.a" \
-a ! -name "core" \
-a ! -name "core.[1-9]*" \
-a ! -name "pvml.[1-9]*" \
-a ! -name "log[0-9]*" \
-a ! -name "so_locations" \
| sed \
-e "\@$packDir/.git/@d" \
-e "\@.svn/@d" \
-e "\@$packDir/lib/@d" \
-e '\@/\.git/@d' \
-e '\@applications/bin/@d' \
-e '\@wmake/bin/@d' \
-e '\@/t/@d' \
-e '\@Make[.A-Za-z]*/[^/]*/@d' \
-e '\@doc/[Dd]oxygen/html@d' \
-e '\@doc/[Dd]oxygen/latex@d' \
-e '\@doc/[Dd]oxygen/man@d' \
-e '\@/lnInclude@d' \
-e '\@/ii_files@d' \
| tee $tmpFile
tar czpf $packFile --files-from $tmpFile
echo "Finished packing and compressing $packDir into file $packFile"
echo "Error: failure packing $packDir into file $packFile" 1>&2
rm -f $packFile 2>/dev/null
fi
#------------------------------------------------------------------------------