2 #------------------------------------------------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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
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
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/>.
26 # foamPackDoxygen [-prefix DIR] [-o outputDir]
29 # Pack and compress the OpenFOAM doxygen html for release
31 #------------------------------------------------------------------------------
32 packDir
=$WM_PROJECT-$WM_PROJECT_VERSION
33 htmlDir
=doc
/Doxygen
/html
37 while [ "$#" -gt 0 ]; do echo "$1"; shift; done
39 Usage: ${0##*/} [OPTION]
41 -b, -bzip2 use bzip2 instead of gzip compression
42 -o, -output <dir> specify alternative output directory
43 -prefix <dir> use alternative prefix
45 * Pack and compress the OpenFOAM doxygen html for release
52 unset prefix outputDir
67 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
72 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
77 usage
"unknown option: '$*'"
82 # if packing from within the directory, use -prefix form
83 if [ "${PWD##*/}" = "$packDir" ]
88 # pack the directories directly and add prefix afterwards
92 elif [ ! -d $packDir ]
94 echo "Error: directory $packDir does not exist" 1>&2
98 #------------------------------------------------------------------------------
99 packName
=${packDir}_Doxygen
101 # add optional output directory
102 [ -d "$outputDir" ] && packName
="$outputDir/$packName"
103 packFile
=$packName.
$packExt
108 echo "Error: $packFile already exists" 1>&2
113 -------------------------------------------------------------------------------
114 Packing doxygen html into $packFile
118 # bzip2 or gzip compression
129 trap 'rm -f $packFile 2>/dev/null' INT
134 tar $tarOpt $packFile --transform="s@^@$prefix/@" $htmlDir
136 tar $tarOpt $packFile $packDir/$htmlDir
141 echo "Finished packing doxygen html into $packFile" 1>&2
143 echo "Error: failure packing doxygen html into $packFile" 1>&2
144 rm -f $packFile 2>/dev
/null
147 #------------------------------------------------------------------------------