2010-05-12 13:27:55 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# ========= |
|
|
|
|
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
|
|
# \\ / O peration |
|
|
|
|
# \\ / A nd | Copyright held by original author
|
|
|
|
# \\/ M anipulation |
|
2011-01-13 17:21:49 +00:00
|
|
|
#------------------------------------------------------------------------------
|
2010-05-12 13:27:55 +00:00
|
|
|
# License
|
|
|
|
# This file is part of OpenFOAM.
|
|
|
|
#
|
|
|
|
# OpenFOAM 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 2 of the License, or (at your
|
|
|
|
# option) any later version.
|
|
|
|
#
|
|
|
|
# OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
#
|
|
|
|
# Script
|
|
|
|
# foamPack [outputDir]
|
|
|
|
#
|
|
|
|
# Description
|
|
|
|
# Packs and compresses the OpenFOAM 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
|
2010-05-27 10:48:11 +00:00
|
|
|
echo "Error: directory $packDir does not exist" 1>&2
|
|
|
|
exit 1
|
2010-05-12 13:27:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# add optional output directory
|
2010-05-27 10:48:11 +00:00
|
|
|
if [ -d "$1" ]
|
|
|
|
then
|
|
|
|
packFile="$1/$packFile"
|
2010-05-12 13:27:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f $packFile ]
|
|
|
|
then
|
2010-05-27 10:48:11 +00:00
|
|
|
echo "Error: $packFile already exists" 1>&2
|
|
|
|
exit 1
|
2010-05-12 13:27:55 +00:00
|
|
|
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" \
|
2010-05-27 10:48:11 +00:00
|
|
|
-e '\@/\.git/@d' \
|
|
|
|
-e '\@applications/bin/@d' \
|
|
|
|
-e '\@wmake/bin/@d' \
|
|
|
|
-e '\@/t/@d' \
|
2010-05-12 13:27:55 +00:00
|
|
|
-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
|
|
|
|
|
2010-05-27 10:48:11 +00:00
|
|
|
if [ $? -eq 0 ]
|
2010-05-12 13:27:55 +00:00
|
|
|
then
|
2010-05-27 10:48:11 +00:00
|
|
|
echo "Finished packing and compressing $packDir into file $packFile"
|
2010-05-12 13:27:55 +00:00
|
|
|
else
|
2010-05-27 10:48:11 +00:00
|
|
|
echo "Error: failure packing $packDir into file $packFile" 1>&2
|
|
|
|
rm -f $packFile 2>/dev/null
|
2010-05-12 13:27:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|