ENH: cylinderAnnulusToCell: new cellSource for cellSets
[OpenFOAM-1.7.x.git] / bin / tools / foamConfigurePaths
blob736721546f78aeb1cfc01b2dab528629215e096a
1 #!/bin/sh
2 #---------------------------------*- sh -*-------------------------------------
3 # ========= |
4 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / O peration |
6 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 # \\/ M anipulation |
8 #------------------------------------------------------------------------------
9 # License
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
20 # for more details.
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/>.
25 # Script
26 # foamConfigurePaths
28 # Description
29 # hardcode installation directory
31 #------------------------------------------------------------------------------
32 usage() {
33 while [ "$#" -ge 1 ]; do echo "$1"; shift; done
34 cat<<USAGE
36 usage: ${0##*/}
37 --foamInstall dir specify installation directory (e.g. /opt)
38 --projectName name specify project name (e.g. openfoam170)
39 --projectVersion ver specify project version (e.g. 1.7.x)
40 --archOption arch specify architecture option (only 32 or 64 applicable)
41 --paraviewInstall dir specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
43 * hardcode paths to installation
45 USAGE
46 exit 1
50 # Function to do replacement on file. Checks if any replacement has been done.
51 # inlineSed <file> <sedCommand> <description>
52 _inlineSed()
54 backup=`tempfile`
55 cp $1 $backup
56 sed -i -e "$2" $1
57 cmp --quiet $1 $backup && usage "Failed : $3"
58 return 0
62 [ -f etc/bashrc -a -f etc/settings.sh ] || usage "Please run from top-level directory of installation"
64 unset foamInstall projectName projectVersion archOption paraviewInstall
66 # parse options
67 while [ "$#" -gt 0 ]
69 case "$1" in
70 -h | --help)
71 usage
73 --foamInstall)
74 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
75 foamInstall="$2"
76 _inlineSed \
77 etc/bashrc \
78 '/^[^#]/s@foamInstall=.*@foamInstall='"$foamInstall@" \
79 "Replacing foamInstall setting by $foamInstall"
80 shift 2
82 --projectName)
83 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
84 projectName="$2"
85 _inlineSed \
86 etc/bashrc \
87 '/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" \
88 "Replacing WM_PROJECT_DIR setting by $projectName"
89 shift 2
91 --projectVersion)
92 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
93 projectVersion="$2"
94 _inlineSed \
95 etc/bashrc \
96 '/^[^#]/s@WM_PROJECT_VERSION=.*@WM_PROJECT_VERSION='"$projectVersion@" \
97 "Replacing WM_PROJECT_VERSION setting by $projectVersion"
98 shift 2
100 --archOption)
101 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
102 archOption="$2"
103 _inlineSed \
104 etc/bashrc \
105 '/^[^#]/s@: ${WM_ARCH_OPTION:=64}@WM_ARCH_OPTION='"$archOption@" \
106 "Replacing WM_ARCH_OPTION setting by $archOption"
107 shift 2
109 --paraviewInstall)
110 [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
111 paraviewInstall="$2"
112 _inlineSed \
113 etc/apps/paraview3/bashrc \
114 '/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" \
115 "Replacing ParaView_DIR setting by $paraviewInstall"
116 shift 2
119 usage "unknown option/argument: '$*'"
121 esac
122 done
124 [ -n "$foamInstall" -o -n "$projectName" -o -n "$projectVersion" -o -n "$archOption" -o -n "$paraviewInstall" ] || usage "Please specify at least one configure option"
126 #echo "Replacing WM_PROJECT setting by $projectName"
127 #sed -i -e 's@WM_PROJECT=.*@WM_PROJECT='"$projectName@" etc/bashrc
129 # Replace the WM_MPLIB always
130 _inlineSed \
131 etc/bashrc \
132 '/^[^#]/s@: ${WM_MPLIB:=.*}@WM_MPLIB=SYSTEMOPENMPI@' \
133 "Replacing WM_MPLIB setting by SYSTEMOPENMPI"
134 ## Replace the compilerInstall always
135 #_inlineSed \
136 # etc/settings.sh \
137 # '/^[^#]/s@: ${compilerInstall:=.*}@compilerInstall=system@' \
138 # "Replacing compilerInstall setting by system"
140 #------------------------------------------------------------------------------