Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openfoam
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
openfoam
Commits
0d470d12
Commit
0d470d12
authored
14 years ago
by
mattijs
Browse files
Options
Downloads
Patches
Plain Diff
ENH: foamConfigurePaths : check that sed has done something
parent
17c42465
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/tools/foamConfigurePaths
+48
-24
48 additions, 24 deletions
bin/tools/foamConfigurePaths
with
48 additions
and
24 deletions
bin/tools/foamConfigurePaths
+
48
−
24
View file @
0d470d12
...
...
@@ -34,10 +34,10 @@ usage() {
cat
<<
USAGE
usage:
${
0
##*/
}
--foamInstall dir
specify installation directory (e.g. /opt)
--projectName name
specify project name (e.g. openfoam170)
--archOption arch
specify architecture option (only 32 or 64 applicable)
--paraviewInstall dir
specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
--foamInstall dir
specify installation directory (e.g. /opt)
--projectName name
specify project name (e.g. openfoam170)
--archOption arch
specify architecture option (only 32 or 64 applicable)
--paraviewInstall dir
specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
* hardcode paths to installation
...
...
@@ -46,6 +46,17 @@ USAGE
}
# Function to do replacement on file. Checks if any replacement has been done.
# inlineSed <file> <sedCommand> <description>
_inlineSed
()
{
backup
=
`
tempfile
`
cp
$1
$backup
sed
-i
-e
"
$2
"
$1
cmp
$1
$backup
||
usage
"Failed :
$3
"
}
[
-f
etc/bashrc
-a
-f
etc/settings.sh
]
||
usage
"Please run from top-level directory of installation"
unset
foamInstall projectName archOption paraviewInstall
...
...
@@ -59,30 +70,40 @@ do
;;
--foamInstall
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
foamInstall
=
"
$2
"
echo
"Replacing foamInstall setting by
$foamInstall
"
sed
-i
-e
'/^[^#]/s@foamInstall=.*@foamInstall='
"
$foamInstall
@"
etc/bashrc
foamInstall
=
"
$2
"
echo
"** foamInstall:
$foamInstall
"
_inlineSed
\
etc/bashrc
\
'/^[^#]/s@foamInstall=.*@foamInstall='
"
$foamInstall
@"
\
"Replacing foamInstall setting by
$foamInstall
"
shift
2
;;
--projectName
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
projectName
=
"
$2
"
echo
"Replacing WM_PROJECT_DIR setting by
$projectName
"
sed
-i
-e
'/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'
"
$projectName
@"
etc/bashrc
shift
2
;;
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
projectName
=
"
$2
"
_inlineSed
\
etc/bashrc
\
'/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'
"
$projectName
@"
\
"Replacing WM_PROJECT_DIR setting by
$projectName
"
shift
2
;;
--archOption
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
archOption
=
"
$2
"
echo
"Replacing WM_ARCH_OPTION setting by
$archOption
"
sed
-i
-e
'/^[^#]/s@: ${WM_ARCH_OPTION:=64}@WM_ARCH_OPTION='
"
$archOption
@"
etc/bashrc
archOption
=
"
$2
"
_inlineSed
\
etc/bashrc
\
'/^[^#]/s@: ${WM_ARCH_OPTION:=64}@WM_ARCH_OPTION='
"
$archOption
@"
\
"Replacing WM_ARCH_OPTION setting by
$archOption
"
shift
2
;;
--paraviewInstall
)
[
"$#"
-ge
2
]
||
usage
"'
$1
' option requires an argument"
paraviewInstall
=
"
$2
"
echo
"Replacing ParaView_DIR setting by
$paraviewInstall
"
sed
-i
-e
'/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='
"
$paraviewInstall
@"
etc/apps/paraview3/bashrc
paraviewInstall
=
"
$2
"
_inlineSed
\
etc/apps/paraview3/bashrc
\
'/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='
"
$paraviewInstall
@"
\
"Replacing ParaView_DIR setting by
$paraviewInstall
"
shift
2
;;
*
)
...
...
@@ -97,11 +118,14 @@ done
#sed -i -e 's@WM_PROJECT=.*@WM_PROJECT='"$projectName@" etc/bashrc
# Replace the WM_MPLIB always
echo
"Replacing WM_MPLIB setting by SYSTEMOPENMPI"
sed
-i
-e
'/^[^#]/s@: ${WM_MPLIB:=.*}@WM_MPLIB=SYSTEMOPENMPI@'
etc/bashrc
_inlineSed
\
etc/bashrc
\
'/^[^#]/s@: ${WM_MPLIB:=.*}@WM_MPLIB=SYSTEMOPENMPI@'
\
"Replacing WM_MPLIB setting by SYSTEMOPENMPI"
# Replace the compilerInstall always
echo
"Replacing compilerInstall setting by system"
sed
-i
-e
'/^[^#]/s@: ${compilerInstall:=.*}@compilerInstall=system@'
etc/settings.sh
_inlineSed
\
etc/settings.sh
\
'/^[^#]/s@: ${compilerInstall:=.*}@compilerInstall=system@'
\
"Replacing compilerInstall setting by system"
#------------------------------------------------------------------------------
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment