2 #---------------------------------*- sh -*-------------------------------------
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
6 # \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
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/>.
29 # hardcode installation directory
31 #------------------------------------------------------------------------------
34 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
38 --foamInstall dir specify installation directory (e.g. /opt)
39 --projectName name specify project name (e.g. openfoam170)
40 --projectVersion ver specify project version (e.g. 1.7.x)
41 --archOption arch specify architecture option (only 32 or 64 applicable)
42 --paraviewInstall dir specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
44 * hardcode paths to installation
51 # Function to do replacement on file. Checks if any replacement has been done.
52 # inlineSed <file> <sedCommand> <description>
56 echo "Missing file: $1"
64 if cmp $1 $backup > /dev
/null
2>&1
66 echo "Failed: $3 in $1"
67 rm $backup 2>/dev
/null
71 rm $backup 2>/dev
/null
78 [ -f etc
/bashrc
] || usage
"Please run from top-level directory of installation"
80 unset foamInstall projectName projectVersion archOption paraviewInstall
89 -foamInstall |
--foamInstall)
90 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
92 # replace foamInstall=...
95 '/^[^#]/s@foamInstall=.*@foamInstall='"$foamInstall@" \
96 "Replacing foamInstall setting by '$foamInstall'"
99 -projectName |
--projectName)
100 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
102 # replace WM_PROJECT_DIR=...
105 '/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \
106 "Replacing WM_PROJECT_DIR setting by $projectName"
110 # [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
111 # projectVersion="$2"
112 # # replace WM_PROJECT_VERSION=...
115 # '/^[^#]/s@WM_PROJECT_VERSION=.*@WM_PROJECT_VERSION='"$projectVersion@" \
116 # "Replacing WM_PROJECT_VERSION setting by $projectVersion"
119 -archOption |
--archOption)
120 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
122 # replace WM_ARCH_OPTION=...
125 '/^[^#]/s@WM_ARCH_OPTION=.*@WM_ARCH_OPTION='"$archOption@" \
126 "Replacing WM_ARCH_OPTION setting by '$archOption'"
129 -paraviewInstall |
--paraviewInstall)
130 [ "$#" -ge 2 ] || usage
"'$1' option requires an argument"
132 # replace ParaView_DIR=...
134 etc
/config
/paraview.sh \
135 '/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" \
136 "Replacing ParaView_DIR setting by '$paraviewInstall'"
140 usage
"unknown option/argument: '$*'"
145 [ -n "$foamInstall" -o -n "$projectName" -o -n "$archOption" -o -n "$paraviewInstall" ] || usage
"Please specify at least one configure option"
147 #echo "Replacing WM_PROJECT setting by '$projectName'"
148 #sed -i -e 's@WM_PROJECT=.*@WM_PROJECT='"$projectName@" etc/bashrc
150 # Set WM_MPLIB=SYSTEMOPENMPI always
153 '/^[^#]/s@export WM_MPLIB=.*@export WM_MPLIB=SYSTEMOPENMPI@' \
154 "Replacing WM_MPLIB setting by 'SYSTEMOPENMPI'"
156 ## set foamCompiler=system always
159 # '/^[^#]/s@foamCompiler=.*@foamCompiler=system@' \
160 # "Replacing foamCompiler setting by 'system'"
162 #------------------------------------------------------------------------------