1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 #------------------------------------------------------------------------------
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 # Clear as many OpenFOAM environment settings as possible
30 #------------------------------------------------------------------------------
32 # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
33 foamClean
=$WM_PROJECT_DIR/bin
/foamCleanPath
34 [ -f "$foamClean" -a -x "$foamClean" ] ||
unset foamClean
36 # The old dirs to be cleaned from the various environment variables
37 # - remove anything under top-level directory.
38 # NB: the WM_PROJECT_INST_DIR might not be identical between versions
40 foamOldDirs
="$WM_PROJECT_INST_DIR $WM_PROJECT_SITE"
41 if [ -n "$WM_PROJECT" ]
43 foamOldDirs
="$foamOldDirs $HOME/$WM_PROJECT/$USER_SITE"
46 #------------------------------------------------------------------------------
47 # unset WM_* environment variables
54 unset WM_COMPILER_LIB_ARCH
55 unset WM_COMPILE_OPTION
61 unset WM_LINK_LANGUAGE
66 unset WM_PRECISION_OPTION
69 unset WM_PROJECT_INST_DIR
71 unset WM_PROJECT_USER_DIR
72 unset WM_PROJECT_VERSION
74 unset WM_THIRD_PARTY_DIR
77 #------------------------------------------------------------------------------
78 # unset FOAM_* environment variables
83 unset FOAM_CODE_TEMPLATES
92 unset FOAM_SITE_APPBIN
93 unset FOAM_SITE_LIBBIN
97 unset FOAM_USER_APPBIN
98 unset FOAM_USER_LIBBIN
102 #------------------------------------------------------------------------------
103 # unset MPI-related environment variables
106 unset MPI_BUFFER_SIZE
109 #------------------------------------------------------------------------------
110 # unset Ensight/ParaView-related environment variables
112 unset ENSIGHT9_READER
118 #------------------------------------------------------------------------------
119 # cleanup environment
120 # PATH, LD_LIBRARY_PATH, MANPATH
122 if [ -n "$foamClean" ]
124 cleaned
=`$foamClean "$PATH" "$foamOldDirs"` && PATH
="$cleaned"
125 cleaned
=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH
="$cleaned"
126 cleaned
=`$foamClean "$MANPATH" "$foamOldDirs"` && MANPATH
="$cleaned"
130 [ -n "$LD_LIBRARY_PATH" ] ||
unset LD_LIBRARY_PATH
131 [ -n "$MANPATH" ] ||
unset MANPATH
132 [ -n "$LD_PRELOAD" ] ||
unset LD_PRELOAD
135 unset cleaned foamClean foamOldDirs
138 #------------------------------------------------------------------------------
172 # ----------------------------------------------------------------- end-of-file