BUG: prefs.sh was sourced in the wrong position in etc/{bashrc,cshrc}

This commit is contained in:
Mark Olesen
2010-03-15 15:15:38 +01:00
parent ee199b9e9a
commit 7308242498
4 changed files with 71 additions and 87 deletions

View File

@ -35,7 +35,7 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# clean the PATH # clean the PATH
cleanedEnv=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"` && PATH="$cleanedEnv" cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath "$PATH" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"` && PATH="$cleaned"
# determine the cmake to be used # determine the cmake to be used
unset CMAKE_HOME unset CMAKE_HOME
@ -92,5 +92,5 @@ else
fi fi
unset cleanedEnv cmake paraviewInstDir paraviewPython unset cleaned cmake paraviewInstDir paraviewPython
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -35,8 +35,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# clean the PATH # clean the PATH
set cleanedEnv=`$WM_PROJECT_DIR/bin/foamCleanPath -space "$path" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"` set cleaned=`$WM_PROJECT_DIR/bin/foamCleanPath -space "$path" "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/cmake- $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/paraview-"`
if ( $status == 0 ) set path=($cleanedEnv) if ( $status == 0 ) set path=($cleaned)
# determine the cmake to be used # determine the cmake to be used
unsetenv CMAKE_HOME unsetenv CMAKE_HOME
@ -89,5 +89,5 @@ else
endif endif
unset cleanedEnv cmake paraviewInstDir paraviewPython unset cleaned cmake paraviewInstDir paraviewPython
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -36,13 +36,13 @@ export WM_PROJECT=OpenFOAM
[ -z "$WM_PROJECT_VERSION" ] && export WM_PROJECT_VERSION=1.6 [ -z "$WM_PROJECT_VERSION" ] && export WM_PROJECT_VERSION=1.6
################################################################################ ################################################################################
# USER EDITABLE PART # USER EDITABLE PART. Note changes made here may be lost with the next upgrade
# #
# either set $FOAM_INST_DIR before sourcing this file or set # either set $FOAM_INST_DIR before sourcing this file or set
# $foamInstall below to where OpenFOAM is installed # $foamInstall below to where OpenFOAM is installed
# #
# Location of FOAM installation # Location of the OpenFOAM installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foamInstall=$HOME/$WM_PROJECT foamInstall=$HOME/$WM_PROJECT
# foamInstall=~$WM_PROJECT # foamInstall=~$WM_PROJECT
# foamInstall=/usr/local/$WM_PROJECT # foamInstall=/usr/local/$WM_PROJECT
@ -54,26 +54,6 @@ foamInstall=$HOME/$WM_PROJECT
# note the location for later use (eg, in job scripts) # note the location for later use (eg, in job scripts)
: ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR : ${FOAM_INST_DIR:=$foamInstall}; export FOAM_INST_DIR
# Source files, possibly with some verbosity
_foamSource()
{
while [ $# -ge 1 ]
do
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
. $1
shift
done
}
# Add in user or site preset preferences.
foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh`
if [ $? -eq 0 ]
then
_foamSource $foamPrefs
fi
unset foamPrefs
# The old dirs to be cleaned from the various environment variables # The old dirs to be cleaned from the various environment variables
# - remove anything under top-level directory. # - remove anything under top-level directory.
# NB: the WM_PROJECT_INST_DIR might not be identical between versions # NB: the WM_PROJECT_INST_DIR might not be identical between versions
@ -90,12 +70,28 @@ export WM_PROJECT_INST_DIR=$FOAM_INST_DIR
export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION
# Location of third-party software # Location of third-party software
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
# Source files, possibly with some verbosity
_foamSource()
{
while [ $# -ge 1 ]
do
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
. $1
shift
done
}
# Add in preset user or site preferences:
foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile prefs.sh` && _foamSource $foamPrefs
unset foamPrefs
# Operating System/Platform # Operating System/Platform
# ~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~
# WM_OSTYPE = POSIX | ???? # WM_OSTYPE = POSIX | ????
@ -106,8 +102,7 @@ export WM_THIRD_PARTY_DIR=$WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: ${WM_COMPILER:=Gcc}; export WM_COMPILER : ${WM_COMPILER:=Gcc}; export WM_COMPILER
export WM_COMPILER_ARCH= unset WM_COMPILER_ARCH WM_COMPILER_LIB_ARCH
export WM_COMPILER_LIB_ARCH=
# Compilation options (architecture, precision, optimised, debug or profiling) # Compilation options (architecture, precision, optimised, debug or profiling)
@ -225,32 +220,22 @@ esac
# Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH) # Clean standard environment variables (PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
#- Clean PATH #- Clean PATH
cleanedEnv=`$cleanProg "$PATH" "$foamOldDirs"` && PATH="$cleanedEnv" cleaned=`$foamClean "$PATH" "$foamOldDirs"` && PATH="$cleaned"
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
cleanedEnv=`$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleanedEnv" cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"` && LD_LIBRARY_PATH="$cleaned"
#- Clean MANPATH #- Clean MANPATH
cleanedEnv=`$cleanProg "$MANPATH" "$foamCleanDirs"` && MANPATH="$cleanedEnv" cleaned=`$foamClean "$MANPATH" "$foamOldDirs"` && MANPATH="$cleaned"
export PATH LD_LIBRARY_PATH MANPATH export PATH LD_LIBRARY_PATH MANPATH
# Source project setup files # Source project setup files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamSource()
{
while [ $# -ge 1 ]
do
[ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
. $1
shift
done
}
_foamSource $WM_PROJECT_DIR/etc/settings.sh _foamSource $WM_PROJECT_DIR/etc/settings.sh
_foamSource $WM_PROJECT_DIR/etc/aliases.sh _foamSource $WM_PROJECT_DIR/etc/aliases.sh
@ -264,27 +249,27 @@ _foamSource $WM_PROJECT_DIR/etc/apps/ensight/bashrc
# Clean environment paths again. Only remove duplicates # Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean PATH #- Clean PATH
cleanedEnv=`$cleanProg "$PATH"` && PATH="$cleanedEnv" cleaned=`$foamClean "$PATH"` && PATH="$cleaned"
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
cleanedEnv=`$cleanProg "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleanedEnv" cleaned=`$foamClean "$LD_LIBRARY_PATH"` && LD_LIBRARY_PATH="$cleaned"
#- Clean MANPATH #- Clean MANPATH (trailing ':' to find system pages)
cleanedEnv=`$cleanProg "$MANPATH"` && MANPATH="$cleanedEnv:" cleaned=`$foamClean "$MANPATH"`: && MANPATH="$cleaned"
export PATH LD_LIBRARY_PATH MANPATH export PATH LD_LIBRARY_PATH MANPATH
#- Clean LD_PRELOAD #- Clean LD_PRELOAD
if [ "$LD_PRELOAD" != "" ] if [ -n "$LD_PRELOAD" ]
then then
cleanedEnv=`$cleanProg "$LD_PRELOAD"` && LD_PRELOAD="$cleanedEnv" cleaned=`$foamClean "$LD_PRELOAD"` && LD_PRELOAD="$cleaned"
export LD_PRELOAD export LD_PRELOAD
fi fi
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unset cleanedEnv cleanProg foamInstall foamOldDirs unset cleaned foamClean foamInstall foamOldDirs
unset _foamSource unset _foamSource
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------

View File

@ -2,7 +2,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
@ -35,13 +35,13 @@ setenv WM_PROJECT OpenFOAM
if ( ! $?WM_PROJECT_VERSION ) setenv WM_PROJECT_VERSION 1.6 if ( ! $?WM_PROJECT_VERSION ) setenv WM_PROJECT_VERSION 1.6
################################################################################ ################################################################################
# USER EDITABLE PART # USER EDITABLE PART. Note changes made here may be lost with the next upgrade
# #
# either setenv FOAM_INST_DIR before sourcing this file or set # either setenv FOAM_INST_DIR before sourcing this file or set
# foamInstall below to where OpenFOAM is installed # foamInstall below to where OpenFOAM is installed
# #
# Location of FOAM installation # Location of the OpenFOAM installation
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set foamInstall = $HOME/$WM_PROJECT set foamInstall = $HOME/$WM_PROJECT
# set foamInstall = ~$WM_PROJECT # set foamInstall = ~$WM_PROJECT
# set foamInstall = /usr/local/$WM_PROJECT # set foamInstall = /usr/local/$WM_PROJECT
@ -53,15 +53,6 @@ set foamInstall = $HOME/$WM_PROJECT
# note the location for later use (eg, in job scripts) # note the location for later use (eg, in job scripts)
if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall if ( ! $?FOAM_INST_DIR ) setenv FOAM_INST_DIR $foamInstall
# Source files, possibly with some verbosity
alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; source \!*'
# Add in user or site preset preferences.
set foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh`
if ( $status == 0 ) _foamSource $foamPrefs
unset foamPrefs
# The old dirs to be cleaned from the various environment variables # The old dirs to be cleaned from the various environment variables
# - remove anything under top-level directory. # - remove anything under top-level directory.
# NB: the WM_PROJECT_INST_DIR might not be identical between versions # NB: the WM_PROJECT_INST_DIR might not be identical between versions
@ -73,12 +64,20 @@ setenv WM_PROJECT_INST_DIR $FOAM_INST_DIR
setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION setenv WM_PROJECT_DIR $WM_PROJECT_INST_DIR/$WM_PROJECT-$WM_PROJECT_VERSION
setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION
# Location of third-party software # Location of third-party software
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION setenv WM_THIRD_PARTY_DIR $WM_PROJECT_INST_DIR/ThirdParty-$WM_PROJECT_VERSION
# Source files, possibly with some verbosity
alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; source \!*'
# Add in preset user or site preferences:
set foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh`
if ( $status == 0 ) _foamSource $foamPrefs
unset foamPrefs
# Operating System/Platform # Operating System/Platform
# ~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~
# WM_OSTYPE = POSIX | ???? # WM_OSTYPE = POSIX | ????
@ -210,29 +209,26 @@ endsw
# Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH) # Clean standard environment variables (path/PATH, LD_LIBRARY_PATH, MANPATH)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
set cleanProg=$WM_PROJECT_DIR/bin/foamCleanPath set foamClean=$WM_PROJECT_DIR/bin/foamCleanPath
if (! $?LD_LIBRARY_PATH ) then if (! $?LD_LIBRARY_PATH ) setenv LD_LIBRARY_PATH ''
setenv LD_LIBRARY_PATH '' if (! $?MANPATH) setenv MANPATH ''
endif
if (! $?MANPATH) then
setenv MANPATH ''
endif
#- Clean path/PATH #- Clean path/PATH
set cleanedEnv=`$cleanProg -space "$path" "$foamOldDirs"` set cleaned=`$foamClean -space "$path" "$foamOldDirs"`
if ( $status == 0 ) set path=($cleanedEnv) if ( $status == 0 ) set path=($cleaned)
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH" "$foamOldDirs"` set cleaned=`$foamClean "$LD_LIBRARY_PATH" "$foamOldDirs"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
#- Clean MANPATH #- Clean MANPATH
setenv MANPATH `$cleanProg "$MANPATH" "$foamOldDirs"` set cleaned=`$foamClean "$MANPATH" "$foamOldDirs"`
if ( $status == 0 ) setenv MANPATH $cleaned
# Source project setup files # Source project setup files
# ~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamSource $WM_PROJECT_DIR/etc/settings.csh _foamSource $WM_PROJECT_DIR/etc/settings.csh
_foamSource $WM_PROJECT_DIR/etc/aliases.csh _foamSource $WM_PROJECT_DIR/etc/aliases.csh
@ -245,23 +241,26 @@ _foamSource $WM_PROJECT_DIR/etc/apps/paraview3/cshrc
# Clean environment paths again. Only remove duplicates # Clean environment paths again. Only remove duplicates
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#- Clean path/PATH #- Clean path/PATH
set cleanedEnv=`$cleanProg -space "$colonPath"` set cleaned=`$foamClean -space "$path"`
if ( $status == 0 ) set path=($cleanedEnv) if ( $status == 0 ) set path=($cleaned)
#- Clean LD_LIBRARY_PATH #- Clean LD_LIBRARY_PATH
setenv LD_LIBRARY_PATH `$cleanProg "$LD_LIBRARY_PATH"` set cleaned=`$foamClean "$LD_LIBRARY_PATH"`
if ( $status == 0 ) setenv LD_LIBRARY_PATH $cleaned
#- Clean MANPATH #- Clean MANPATH (trailing ':' to find system pages)
setenv MANPATH `$cleanProg "$MANPATH"`: set cleaned=`$foamClean "$MANPATH"`:
if ( $status == 0 ) setenv MANPATH "$cleaned"
#- Clean LD_PRELOAD #- Clean LD_PRELOAD
if ( $?LD_PRELOAD ) then if ( $?LD_PRELOAD ) then
setenv LD_PRELOAD `$cleanProg "$LD_PRELOAD"` set cleaned=`$foamClean "$LD_PRELOAD"`
if ( $status == 0 ) setenv LD_PRELOAD $cleaned
endif endif
# cleanup environment: # cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~
unset cleanedEnv cleanProg colonPath foamInstall foamOldDirs unset cleaned foamClean foamInstall foamOldDirs
unalias _foamSource unalias _foamSource
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------