diff --git a/etc/bashrc b/etc/bashrc index 07e5411ce3..b1a4cc45db 100644 --- a/etc/bashrc +++ b/etc/bashrc @@ -27,7 +27,15 @@ # - $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION/prefs.sh # - $WM_PROJECT_SITE/site/prefs.sh # -# Note: Changes made to this bashrc file may be lost with the next upgrade. +# Environment +# FOAM_VERBOSE (set/unset) +# - add extra verbosity when sourcing files +# FOAM_CONFIG_NOUSER (set/unset) +# - suppress use of user/group configuration files +# +# Note +# Changes made to this bashrc file may be lost with the next upgrade. +# #------------------------------------------------------------------------------ export WM_PROJECT=OpenFOAM @@ -130,13 +138,22 @@ export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT/$USER-$WM_PROJECT_VERSION . $WM_PROJECT_DIR/etc/config.sh/functions # Overrides via -_foamEtc -mode=o prefs.sh # 1) other (system) values -_foamEtc -mode=ug prefs.sh # 2) user or group values +# 1. other (system) values +_foamEtc -mode=o prefs.sh + +# 2. user or group values (unless disabled) +[ -z "$FOAM_CONFIG_NOUSER" ] && _foamEtc -mode=ug prefs.sh # Evaluate command-line parameters and record settings for later. # These can be used to set/unset values, specify additional files etc. -export FOAM_SETTINGS="$@" -_foamEval $@ +FOAM_SETTINGS="$@" +if [ -z "$FOAM_SETTINGS" ] +then + unset FOAM_SETTINGS +else + export FOAM_SETTINGS + _foamEval $@ +fi # Clean standard environment variables (PATH, MANPATH, LD_LIBRARY_PATH) # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/etc/config.csh/compiler b/etc/config.csh/compiler index 2083665f46..7ca721fe5f 100644 --- a/etc/config.csh/compiler +++ b/etc/config.csh/compiler @@ -15,12 +15,14 @@ # # Description # Setup for custom compiler versions for OpenFOAM +# Per-compiler overrides in "compiler-$WM_COMPILER" files # #------------------------------------------------------------------------------ switch ("$WM_COMPILER_TYPE") case ThirdParty: # Default versions of GMP, MPFR, MPC - override as necessary + set gmp_version=gmp-system set mpfr_version=mpfr-system set mpc_version=mpc-system @@ -102,6 +104,9 @@ Please check your settings UNKNOWN_COMPILER breaksw endsw + + # Per-compiler overrides in "compiler-$WM_COMPILER" files + _foamEtc -config "compiler-$WM_COMPILER" breaksw endsw diff --git a/etc/config.csh/functions b/etc/config.csh/functions index cd03815058..7365e632bc 100644 --- a/etc/config.csh/functions +++ b/etc/config.csh/functions @@ -35,9 +35,17 @@ alias _foamAddLibAuto 'eval `$WM_PROJECT_DIR/bin/tools/lib-dir -csh \!*`' # Source an etc file, possibly with some verbosity if ($?FOAM_VERBOSE && $?prompt) then - alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`' + if ($?FOAM_CONFIG_NOUSER) then + alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose -mode=o \!*`' + else + alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh-verbose \!*`' + endif else - alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`' + if ($?FOAM_CONFIG_NOUSER) then + alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh -mode=o \!*`' + else + alias _foamEtc 'eval `$WM_PROJECT_DIR/bin/foamEtcFile -csh \!*`' + endif endif diff --git a/etc/config.sh/compiler b/etc/config.sh/compiler index 5c9c318dd1..efa2e135a1 100644 --- a/etc/config.sh/compiler +++ b/etc/config.sh/compiler @@ -15,6 +15,7 @@ # # Description # Setup for custom compiler versions for OpenFOAM +# Per-compiler overrides in "compiler-$WM_COMPILER" files # #------------------------------------------------------------------------------ @@ -100,6 +101,9 @@ Please check your settings UNKNOWN_COMPILER ;; esac + + # Per-compiler overrides in "compiler-$WM_COMPILER" files + _foamEtc -config "compiler-$WM_COMPILER" ;; esac diff --git a/etc/config.sh/functions b/etc/config.sh/functions index 9358e2d9ba..0ff0ea3704 100644 --- a/etc/config.sh/functions +++ b/etc/config.sh/functions @@ -16,7 +16,7 @@ # Description # Shell functions and variables used when sourcing the OpenFOAM environment # -# Some functionality is shadowed in bin/tools/lib-dir +# Some functionality mirrored by bin/tools/lib-dir # #------------------------------------------------------------------------------ @@ -33,11 +33,27 @@ then # Cleaning environment variables _foamClean() { - local var=$1 + foamVar_name=$1 shift - eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=$var "$@") + eval $($WM_PROJECT_DIR/bin/foamCleanPath -sh-env=$foamVar_name "$@") + unset foamVar_name } + # Source an etc file, possibly with some verbosity + # - use eval to avoid intermediate variables (ksh doesn't have 'local') + if [ "$FOAM_VERBOSE" -a "$PS1" ] + then + _foamEtc() + { + eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh-verbose ${FOAM_CONFIG_NOUSER:+-mode=o} $@)"; + } + else + _foamEtc() + { + eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh ${FOAM_CONFIG_NOUSER:+-mode=o} $@)"; + } + fi + # Prepend PATH _foamAddPath() { @@ -133,15 +149,6 @@ then fi - # Source an etc file, possibly with some verbosity - # - use eval to avoid intermediate variables (ksh doesn't have 'local') - if [ "$FOAM_VERBOSE" -a "$PS1" ] - then - _foamEtc(){ eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh-verbose $@)"; } - else - _foamEtc(){ eval "$($WM_PROJECT_DIR/bin/foamEtcFile -sh $@)"; } - fi - # Evaluate command-line parameters _foamEval() { diff --git a/etc/cshrc b/etc/cshrc index a1125b5b70..6333be76e0 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -27,7 +27,15 @@ # - $WM_PROJECT_SITE/site/$WM_PROJECT_VERSION/prefs.csh # - $WM_PROJECT_SITE/site/prefs.csh # -# Note: Changes made to this cshrc file may be lost with the next upgrade. +# Environment +# FOAM_VERBOSE (set/unset) +# - add extra verbosity when sourcing files +# FOAM_CONFIG_NOUSER (set/unset) +# - suppress use of user/group configuration files +# +# Note +# Changes made to this cshrc file may be lost with the next upgrade. +# #------------------------------------------------------------------------------ setenv WM_PROJECT OpenFOAM @@ -141,8 +149,13 @@ setenv WM_PROJECT_USER_DIR $HOME/$WM_PROJECT/$LOGNAME-$WM_PROJECT_VERSION source $WM_PROJECT_DIR/etc/config.csh/functions # Overrides via -_foamEtc -mode=o prefs.csh # 1) other (system) systems -_foamEtc -mode=ug prefs.csh # 2) user or group settings +# 1. other (system) values +_foamEtc -mode=o prefs.csh + +# 2. user or group values (unless disabled) +if (! $?FOAM_CONFIG_NOUSER ) then + _foamEtc -mode=ug prefs.csh +endif # Evaluate command-line parameters and record settings for later. # These can be used to set/unset values, specify additional files etc. @@ -188,7 +201,6 @@ _foamClean PATH "$foamOldDirs" _foamClean MANPATH "$foamOldDirs" _foamClean LD_LIBRARY_PATH "$foamOldDirs" - # Setup for OpenFOAM compilation etc # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _foamEtc -config settings