This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/bin/foamPack

114 lines
3.3 KiB
Text
Raw Normal View History

#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
2013-12-11 16:09:41 +00:00
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration |
2013-12-11 16:09:41 +00:00
# \\ / A nd | For copyright notice see file Copyright
# \\/ M anipulation |
2011-01-13 17:21:49 +00:00
#------------------------------------------------------------------------------
# License
2013-12-11 16:09:41 +00:00
# This file is part of foam-extend.
#
2013-12-11 16:09:41 +00:00
# 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
2013-12-11 16:09:41 +00:00
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
2013-12-11 16:09:41 +00:00
# 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
2013-12-11 16:09:41 +00:00
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# foamPack [outputDir]
#
# Description
2013-12-11 16:09:41 +00:00
# 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
2010-05-27 10:48:11 +00:00
echo "Error: directory $packDir does not exist" 1>&2
exit 1
fi
# add optional output directory
2010-05-27 10:48:11 +00:00
if [ -d "$1" ]
then
packFile="$1/$packFile"
fi
if [ -f $packFile ]
then
2010-05-27 10:48:11 +00:00
echo "Error: $packFile already exists" 1>&2
exit 1
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' \
-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 ]
then
2010-05-27 10:48:11 +00:00
echo "Finished packing and compressing $packDir into file $packFile"
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
fi
#------------------------------------------------------------------------------