From 715d1bf2c08a961a111b187fe09425e92cdc394d Mon Sep 17 00:00:00 2001
From: Henry Weller <http://cfd.direct>
Date: Wed, 10 Feb 2016 10:22:25 +0000
Subject: [PATCH] OpenFOAM-dev/etc: separated scripts for bash and csh into
 separate directories etc/config.sh and etc/config.csh

This structure is more convenient to add support for other shells, e.g. zsh, fish etc.

Resolves feature request to simplify support for other shells in
http://www.openfoam.org/mantisbt/view.php?id=1232
---
 etc/README.org                                | 20 +++++++
 etc/bashrc                                    | 14 ++---
 etc/{config/CGAL.csh => config.csh/CGAL}      |  4 +-
 .../aliases.csh => config.csh/aliases}        |  8 +--
 .../ensight.csh => config.csh/ensight}        |  4 +-
 .../example/compiler}                         |  6 +--
 .../example/openmpi}                          |  6 +--
 .../example/paraview}                         |  8 +--
 etc/{config => config.csh}/example/prefs.csh  |  4 +-
 .../paraview.csh => config.csh/paraview}      |  2 +-
 .../settings.csh => config.csh/settings}      | 26 ++++-----
 etc/{config/unset.csh => config.csh/unset}    |  4 +-
 etc/{config/CGAL.sh => config.sh/CGAL}        |  4 +-
 etc/{config/aliases.sh => config.sh/aliases}  |  8 +--
 etc/{config/ensight.sh => config.sh/ensight}  |  4 +-
 .../example/compiler}                         |  6 +--
 .../openmpi.sh => config.sh/example/openmpi}  |  6 +--
 .../example/paraview}                         | 10 ++--
 etc/{config => config.sh}/example/prefs.sh    |  4 +-
 .../gperftools.sh => config.sh/gperftools}    |  4 +-
 etc/{config/metis.sh => config.sh/metis}      |  4 +-
 .../paraview.sh => config.sh/paraview}        |  2 +-
 etc/{config/scotch.sh => config.sh/scotch}    |  4 +-
 .../settings.sh => config.sh/settings}        | 26 ++++-----
 etc/{config/unset.sh => config.sh/unset}      |  4 +-
 etc/config/README                             | 54 -------------------
 etc/cshrc                                     | 12 ++---
 27 files changed, 112 insertions(+), 146 deletions(-)
 create mode 100644 etc/README.org
 rename etc/{config/CGAL.csh => config.csh/CGAL} (95%)
 rename etc/{config/aliases.csh => config.csh/aliases} (92%)
 rename etc/{config/ensight.csh => config.csh/ensight} (94%)
 rename etc/{config/example/compiler.csh => config.csh/example/compiler} (90%)
 rename etc/{config/example/openmpi.csh => config.csh/example/openmpi} (88%)
 rename etc/{config/example/paraview.csh => config.csh/example/paraview} (86%)
 rename etc/{config => config.csh}/example/prefs.csh (94%)
 rename etc/{config/paraview.csh => config.csh/paraview} (99%)
 rename etc/{config/settings.csh => config.csh/settings} (95%)
 rename etc/{config/unset.csh => config.csh/unset} (98%)
 rename etc/{config/CGAL.sh => config.sh/CGAL} (95%)
 rename etc/{config/aliases.sh => config.sh/aliases} (92%)
 rename etc/{config/ensight.sh => config.sh/ensight} (94%)
 rename etc/{config/example/compiler.sh => config.sh/example/compiler} (90%)
 rename etc/{config/example/openmpi.sh => config.sh/example/openmpi} (88%)
 rename etc/{config/example/paraview.sh => config.sh/example/paraview} (82%)
 rename etc/{config => config.sh}/example/prefs.sh (94%)
 rename etc/{config/gperftools.sh => config.sh/gperftools} (93%)
 rename etc/{config/metis.sh => config.sh/metis} (94%)
 rename etc/{config/paraview.sh => config.sh/paraview} (99%)
 rename etc/{config/scotch.sh => config.sh/scotch} (94%)
 rename etc/{config/settings.sh => config.sh/settings} (95%)
 rename etc/{config/unset.sh => config.sh/unset} (97%)
 delete mode 100644 etc/config/README

diff --git a/etc/README.org b/etc/README.org
new file mode 100644
index 0000000000..139918db97
--- /dev/null
+++ b/etc/README.org
@@ -0,0 +1,20 @@
+* OpenFOAM Configuration
+  The main OpenFOAM settings are located in the parent etc/ directory.  The bash
+  and csh shells are supported and to configure OpenFOAM source etc/bashrc or
+  etc/cshrc respectively which source the following files in the config.sh or
+  config.csh respectively:
+  + =settings=: core settings
+  + =aliases=: aliases for interactive shells
+  + =unset=: sourced to clear as many OpenFOAM environment settings as possible
+  + =ensight=: application settings for EnSight
+  + =paraview=: application settings for ParaView
+  + =scotch=: application settings for compiling against scotch
+  + =metis=: application settings for compiling against metis 5
+
+  The config.*/example directories contains various example configuration files
+  for the corresponding shell:
+  + =compiler=: an example of fine tuning ThirdParty compiler settings
+  + =openmpi=: an example of fine tuning openmpi settings for OpenFOAM
+  + =paraview=: an example of chaining to the standard config/paraview with a
+    different ParaView_VERSION
+  + =prefs=: an example of supplying alternative site-defined settings
diff --git a/etc/bashrc b/etc/bashrc
index 18fad39985..892d23e719 100644
--- a/etc/bashrc
+++ b/etc/bashrc
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -211,16 +211,16 @@ export PATH LD_LIBRARY_PATH MANPATH
 
 # Source project setup files
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
-_foamSource $WM_PROJECT_DIR/etc/config/settings.sh
-_foamSource $WM_PROJECT_DIR/etc/config/aliases.sh
+_foamSource $WM_PROJECT_DIR/etc/config.sh/settings
+_foamSource $WM_PROJECT_DIR/etc/config.sh/aliases
 
 
 # Source user setup files for optional packages
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.sh`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.sh`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/gperftools.sh`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/CGAL.sh`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/paraview`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/ensight`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/gperftools`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/CGAL`
 
 
 # Clean environment paths again. Only remove duplicates
diff --git a/etc/config/CGAL.csh b/etc/config.csh/CGAL
similarity index 95%
rename from etc/config/CGAL.csh
rename to etc/config.csh/CGAL
index 7269587c30..1627935ef3 100644
--- a/etc/config/CGAL.csh
+++ b/etc/config.csh/CGAL
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2014-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2014-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/CGAL.csh
+#     config.csh/CGAL
 #
 # Description
 #     Setup file for CGAL (& boost) include/libraries.
diff --git a/etc/config/aliases.csh b/etc/config.csh/aliases
similarity index 92%
rename from etc/config/aliases.csh
rename to etc/config.csh/aliases
index 489a771268..d95bfb3b22 100644
--- a/etc/config/aliases.csh
+++ b/etc/config.csh/aliases
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     etc/config/aliases.csh
+#     etc/config.csh/aliases
 #
 # Description
 #     Aliases for working with OpenFOAM
@@ -42,7 +42,7 @@ alias wmDP 'wmSET WM_PRECISION_OPTION=DP'
 alias wmREFRESH 'wmSET $FOAM_SETTINGS'
 
 # clear env
-alias wmUNSET 'source $WM_PROJECT_DIR/etc/config/unset.csh'
+alias wmUNSET 'source $WM_PROJECT_DIR/etc/config.csh/unset'
 
 # Toggle wmakeScheduler on/off
 #  - also need to set WM_HOSTS
@@ -52,7 +52,7 @@ alias wmSchedOFF 'unsetenv WM_SCHEDULER'
 
 # Change ParaView version
 # ~~~~~~~~~~~~~~~~~~~~~~~
-alias foamPV 'source `$WM_PROJECT_DIR/etc/config/paraview.csh` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION'
+alias foamPV 'source `$WM_PROJECT_DIR/etc/config.csh/paraview` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION'
 
 
 # Change directory aliases
diff --git a/etc/config/ensight.csh b/etc/config.csh/ensight
similarity index 94%
rename from etc/config/ensight.csh
rename to etc/config.csh/ensight
index bdf4ac29e5..5e9eda5a54 100644
--- a/etc/config/ensight.csh
+++ b/etc/config.csh/ensight
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #-------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/ensight.csh
+#     config.csh/ensight
 #
 # Description
 #     Setup file for Ensight
diff --git a/etc/config/example/compiler.csh b/etc/config.csh/example/compiler
similarity index 90%
rename from etc/config/example/compiler.csh
rename to etc/config.csh/example/compiler
index 4310f43cc7..2eed7a3c04 100644
--- a/etc/config/example/compiler.csh
+++ b/etc/config.csh/example/compiler
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,11 +22,11 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/example/compiler.csh
+#     config.csh/example/compiler
 #
 # Description
 #     Example of fine tuning ThirdParty compiler settings for OpenFOAM
-#     Sourced from OpenFOAM-<VERSION>/etc/config/settings.csh
+#     Sourced from OpenFOAM-<VERSION>/etc/config.csh/settings
 #
 #------------------------------------------------------------------------------
 
diff --git a/etc/config/example/openmpi.csh b/etc/config.csh/example/openmpi
similarity index 88%
rename from etc/config/example/openmpi.csh
rename to etc/config.csh/example/openmpi
index dc4854b53f..293475ff35 100644
--- a/etc/config/example/openmpi.csh
+++ b/etc/config.csh/example/openmpi
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,11 +22,11 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/example/openmpi.csh
+#     config.csh/example/openmpi
 #
 # Description
 #     Example of fine tuning openmpi settings for OpenFOAM
-#     Sourced from OpenFOAM-<VERSION>/etc/config/settings.csh
+#     Sourced from OpenFOAM-<VERSION>/etc/config.csh/settings
 #
 #------------------------------------------------------------------------------
 
diff --git a/etc/config/example/paraview.csh b/etc/config.csh/example/paraview
similarity index 86%
rename from etc/config/example/paraview.csh
rename to etc/config.csh/example/paraview
index 9b639c74ba..7c163df9c7 100644
--- a/etc/config/example/paraview.csh
+++ b/etc/config.csh/example/paraview
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,10 +22,10 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/example/paraview.csh
+#     config.csh/example/paraview
 #
 # Description
-#     Example of chaining to the standard config/paraview.csh with a
+#     Example of chaining to the standard config.csh/paraview with a
 #     different ParaView_VERSION
 #
 # Note
@@ -38,7 +38,7 @@
 # Use other (shipped) paraview.csh with a different ParaView_VERSION
 #
 
-set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o config/paraview.csh`
+set foamFile=`$WM_PROJECT_DIR/bin/foamEtcFile -mode o config.csh/paraview`
 if ( $status == 0 ) source $foamFile ParaView_VERSION=3.12.0
 
 unset foamFile
diff --git a/etc/config/example/prefs.csh b/etc/config.csh/example/prefs.csh
similarity index 94%
rename from etc/config/example/prefs.csh
rename to etc/config.csh/example/prefs.csh
index 03fb5d048f..c9db36cefe 100644
--- a/etc/config/example/prefs.csh
+++ b/etc/config.csh/example/prefs.csh
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/example/prefs.csh
+#     config.csh/example/prefs.csh
 #
 # Description
 #     Preset variables for the OpenFOAM configuration - C-Shell shell syntax.
diff --git a/etc/config/paraview.csh b/etc/config.csh/paraview
similarity index 99%
rename from etc/config/paraview.csh
rename to etc/config.csh/paraview
index f89ff0ed33..c4a5dad835 100644
--- a/etc/config/paraview.csh
+++ b/etc/config.csh/paraview
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/paraview.csh
+#     config.csh/paraview
 #
 # Description
 #     Setup file for paraview-[3-5].x
diff --git a/etc/config/settings.csh b/etc/config.csh/settings
similarity index 95%
rename from etc/config/settings.csh
rename to etc/config.csh/settings
index fb6a1cf2a0..d1d9dac611 100644
--- a/etc/config/settings.csh
+++ b/etc/config.csh/settings
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     etc/config/settings.csh
+#     etc/config.csh/settings
 #
 # Description
 #     Startup file for OpenFOAM
@@ -209,7 +209,7 @@ unsetenv MPFR_ARCH_PATH GMP_ARCH_PATH
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 if ( ! $?foamCompiler ) then
     set foamCompiler=system
-    echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+    echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
     echo "    foamCompiler not set, using '$foamCompiler'"
 endif
 
@@ -254,7 +254,7 @@ case ThirdParty:
         breaksw
     default:
         echo
-        echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+        echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
         echo "    Unknown OpenFOAM compiler type '$WM_COMPILER'"
         echo "    Please check your settings"
         echo
@@ -262,7 +262,7 @@ case ThirdParty:
     endsw
 
     # Optional configuration tweaks:
-    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.csh`
+    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/compiler`
 
     if ( $?gcc_version ) then
         set gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
@@ -275,7 +275,7 @@ case ThirdParty:
         # Check that the compiler directory can be found
         if ( ! -d "$gccDir" ) then
             echo
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+            echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
             echo "    Cannot find $gccDir installation."
             echo "    Please install this compiler version or if you wish to" \
                  " use the system compiler,"
@@ -311,7 +311,7 @@ case ThirdParty:
         # Check that the compiler directory can be found
         if ( ! -d "$clangDir" ) then
             echo
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+            echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
             echo "    Cannot find $clangDir installation."
             echo "    Please install this compiler version or if you wish to" \
                  " use the system compiler,"
@@ -360,7 +360,7 @@ case SYSTEMOPENMPI:
 case OPENMPI:
     setenv FOAM_MPI openmpi-1.10.0
     # Optional configuration tweaks:
-    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.csh`
+    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/openmpi`
 
     setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
 
@@ -381,7 +381,7 @@ case SYSTEMMPI:
 
     if ( ! ($?MPI_ROOT) ) then
         echo
-        echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+        echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
         echo "    Please set the environment variable MPI_ROOT to point to" \
              " the base folder for the system MPI in use."
         echo "    Example:"
@@ -393,7 +393,7 @@ case SYSTEMMPI:
 
         if ( ! ($?MPI_ARCH_FLAGS) ) then
             echo
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+            echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
             echo "    MPI_ARCH_FLAGS is not set. Example:"
             echo
             echo '        setenv MPI_ARCH_FLAGS "-DOMPI_SKIP_MPICXX"'
@@ -402,7 +402,7 @@ case SYSTEMMPI:
 
         if ( ! ($?MPI_ARCH_INC) ) then
             echo
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+            echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
             echo "    MPI_ARCH_INC is not set. Example:"
             echo
             echo '        setenv MPI_ARCH_INC "-isystem $MPI_ROOT/include"'
@@ -411,7 +411,7 @@ case SYSTEMMPI:
 
         if ( ! ($?MPI_ARCH_LIBS) ) then
             echo
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+            echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
             echo "    MPI_ARCH_LIBS is not set. Example:"
             echo
             echo '        setenv MPI_ARCH_LIBS "-L$MPI_ROOT/lib -lmpi"'
@@ -499,7 +499,7 @@ case SGIMPI:
     if ( ! $?MPI_ROOT) setenv MPI_ROOT /dummy
 
     if ( ! -d "$MPI_ROOT" ) then
-        echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+        echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
         echo "    MPI_ROOT not a valid mpt installation directory."
         echo "    Please set MPI_ROOT to the mpt installation directory."
         echo "    (usually done by loading the mpt module)"
@@ -529,7 +529,7 @@ case INTELMPI:
     if ( ! $?MPI_ROOT) setenv MPI_ROOT /dummy
 
     if ( ! -d "$MPI_ROOT" ) then
-        echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
+        echo "Warning in $WM_PROJECT_DIR/etc/config.csh/settings:"
         echo "    MPI_ROOT not a valid mpt installation directory."
         echo "    Please set MPI_ROOT to the mpt installation directory."
         echo "    (usually done by loading the mpt module)"
diff --git a/etc/config/unset.csh b/etc/config.csh/unset
similarity index 98%
rename from etc/config/unset.csh
rename to etc/config.csh/unset
index 928f08f442..efcd21ee3f 100644
--- a/etc/config/unset.csh
+++ b/etc/config.csh/unset
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     etc/config/unset.csh
+#     etc/config.csh/unset
 #
 # Description
 #     Clear as many OpenFOAM environment settings as possible
diff --git a/etc/config/CGAL.sh b/etc/config.sh/CGAL
similarity index 95%
rename from etc/config/CGAL.sh
rename to etc/config.sh/CGAL
index 7a59fc6e00..221fa4bba2 100644
--- a/etc/config/CGAL.sh
+++ b/etc/config.sh/CGAL
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2014-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2014-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/CGAL.sh
+#     config.sh/CGAL
 #
 # Description
 #     Setup file for CGAL (& boost) include/libraries.
diff --git a/etc/config/aliases.sh b/etc/config.sh/aliases
similarity index 92%
rename from etc/config/aliases.sh
rename to etc/config.sh/aliases
index 7f120a5caa..40d4c88e0e 100644
--- a/etc/config/aliases.sh
+++ b/etc/config.sh/aliases
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     etc/config/aliases.sh
+#     etc/config.sh/aliases
 #
 # Description
 #     Aliases for working with OpenFOAM
@@ -42,7 +42,7 @@ alias wmDP='wmSET WM_PRECISION_OPTION=DP'
 alias wmREFRESH='wmSET $FOAM_SETTINGS'
 
 # clear env
-alias wmUNSET='. $WM_PROJECT_DIR/etc/config/unset.sh'
+alias wmUNSET='. $WM_PROJECT_DIR/etc/config.sh/unset'
 
 # Toggle wmakeScheduler on/off
 #  - also need to set WM_HOSTS
@@ -55,7 +55,7 @@ alias wmSchedOFF='unset WM_SCHEDULER'
 unset foamPV
 foamPV()
 {
-    . $WM_PROJECT_DIR/etc/config/paraview.sh ParaView_VERSION=$1
+    . $WM_PROJECT_DIR/etc/config.sh/paraview ParaView_VERSION=$1
     echo "paraview-$ParaView_VERSION  (major: $ParaView_MAJOR)" 1>&2
 }
 
diff --git a/etc/config/ensight.sh b/etc/config.sh/ensight
similarity index 94%
rename from etc/config/ensight.sh
rename to etc/config.sh/ensight
index 75d7a3221e..e0aa567384 100644
--- a/etc/config/ensight.sh
+++ b/etc/config.sh/ensight
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/ensight.sh
+#     config.sh/ensight
 #
 # Description
 #     Setup file for Ensight
diff --git a/etc/config/example/compiler.sh b/etc/config.sh/example/compiler
similarity index 90%
rename from etc/config/example/compiler.sh
rename to etc/config.sh/example/compiler
index 4b4fdd9d70..a1238c9223 100644
--- a/etc/config/example/compiler.sh
+++ b/etc/config.sh/example/compiler
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,11 +22,11 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/example/compiler.sh
+#     config.sh/example/compiler
 #
 # Description
 #     Example of fine tuning ThirdParty compiler settings for OpenFOAM
-#     Sourced from OpenFOAM-<VERSION>/etc/config/settings.sh
+#     Sourced from OpenFOAM-<VERSION>/etc/config.sh/settings
 #
 #------------------------------------------------------------------------------
 
diff --git a/etc/config/example/openmpi.sh b/etc/config.sh/example/openmpi
similarity index 88%
rename from etc/config/example/openmpi.sh
rename to etc/config.sh/example/openmpi
index cbb6957a45..cd2acc320f 100644
--- a/etc/config/example/openmpi.sh
+++ b/etc/config.sh/example/openmpi
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,11 +22,11 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/example/openmpi.sh
+#     config.sh/example/openmpi
 #
 # Description
 #     Example of fine tuning openmpi settings for OpenFOAM
-#     Sourced from OpenFOAM-<VERSION>/etc/config/settings.sh
+#     Sourced from OpenFOAM-<VERSION>/etc/config.sh/settings
 #
 #------------------------------------------------------------------------------
 
diff --git a/etc/config/example/paraview.sh b/etc/config.sh/example/paraview
similarity index 82%
rename from etc/config/example/paraview.sh
rename to etc/config.sh/example/paraview
index 9586dc81dc..f958f431e2 100644
--- a/etc/config/example/paraview.sh
+++ b/etc/config.sh/example/paraview
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,10 +22,10 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/example/paraview.sh
+#     config.sh/example/paraview
 #
 # Description
-#     Example of chaining to the standard config/paraview.sh with a
+#     Example of chaining to the standard config.sh/paraview with a
 #     different ParaView_VERSION
 #
 # Note
@@ -35,10 +35,10 @@
 #------------------------------------------------------------------------------
 
 #
-# Use other (shipped) paraview.sh with a different ParaView_VERSION
+# Use other (shipped) paraview with a different ParaView_VERSION
 #
 
-foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config/paraview.sh 2>/dev/null)
+foamFile=$($WM_PROJECT_DIR/bin/foamEtcFile -mode o config.sh/paraview 2>/dev/null)
 [ $? -eq 0 ] && . $foamFile ParaView_VERSION=3.12.0
 
 unset foamFile
diff --git a/etc/config/example/prefs.sh b/etc/config.sh/example/prefs.sh
similarity index 94%
rename from etc/config/example/prefs.sh
rename to etc/config.sh/example/prefs.sh
index eec63fc545..2992298887 100644
--- a/etc/config/example/prefs.sh
+++ b/etc/config.sh/example/prefs.sh
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/example/prefs.sh
+#     config.sh/example/prefs.sh
 #
 # Description
 #     Preset variables for the OpenFOAM configuration - POSIX shell syntax.
diff --git a/etc/config/gperftools.sh b/etc/config.sh/gperftools
similarity index 93%
rename from etc/config/gperftools.sh
rename to etc/config.sh/gperftools
index f71a6cf2af..e096eb0762 100644
--- a/etc/config/gperftools.sh
+++ b/etc/config.sh/gperftools
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2012 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2012-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/gperftools.sh
+#     config.sh/gperftools
 #
 # Description
 #     Setup file for gperftools binaries libraries.
diff --git a/etc/config/metis.sh b/etc/config.sh/metis
similarity index 94%
rename from etc/config/metis.sh
rename to etc/config.sh/metis
index af7efde3ac..f912611a3a 100644
--- a/etc/config/metis.sh
+++ b/etc/config.sh/metis
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2013 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2013-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/metis.sh
+#     config.sh/metis
 #
 # Description
 #     Setup file for metis include/libraries.
diff --git a/etc/config/paraview.sh b/etc/config.sh/paraview
similarity index 99%
rename from etc/config/paraview.sh
rename to etc/config.sh/paraview
index 7ac247b174..33fb031d24 100644
--- a/etc/config/paraview.sh
+++ b/etc/config.sh/paraview
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/paraview.sh
+#     config.sh/paraview
 #
 # Description
 #     Setup file for paraview-[3-5].x
diff --git a/etc/config/scotch.sh b/etc/config.sh/scotch
similarity index 94%
rename from etc/config/scotch.sh
rename to etc/config.sh/scotch
index e40e1c7bdf..a52c58e59d 100644
--- a/etc/config/scotch.sh
+++ b/etc/config.sh/scotch
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     config/scotch.sh
+#     config.sh/scotch
 #
 # Description
 #     Setup file for scotch include/libraries.
diff --git a/etc/config/settings.sh b/etc/config.sh/settings
similarity index 95%
rename from etc/config/settings.sh
rename to etc/config.sh/settings
index 1a838cebaa..0a613c935d 100644
--- a/etc/config/settings.sh
+++ b/etc/config.sh/settings
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     etc/config/settings.sh
+#     etc/config.sh/settings
 #
 # Description
 #     Startup file for OpenFOAM
@@ -236,7 +236,7 @@ unset MPFR_ARCH_PATH GMP_ARCH_PATH
 if [ -z "$foamCompiler" ]
 then
     foamCompiler=system
-    echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+    echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
     echo "    foamCompiler not set, using '$foamCompiler'" 1>&2
 fi
 
@@ -279,7 +279,7 @@ OpenFOAM | ThirdParty)
         ;;
     *)
         echo 1>&2
-        echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+        echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
         echo "    Unknown OpenFOAM compiler type '$WM_COMPILER'" 1>&2
         echo "    Please check your settings" 1>&2
         echo 1>&2
@@ -287,7 +287,7 @@ OpenFOAM | ThirdParty)
     esac
 
     # Optional configuration tweaks:
-    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.sh`
+    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/compiler`
 
     if [ -n "$gcc_version" ]
     then
@@ -299,7 +299,7 @@ OpenFOAM | ThirdParty)
         # Check that the compiler directory can be found
         [ -d "$gccDir" ] || {
             echo 1>&2
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+            echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
             echo "    Cannot find $gccDir installation." 1>&2
             echo "    Please install this compiler version or if you wish to" \
                  " use the system compiler," 1>&2
@@ -337,7 +337,7 @@ OpenFOAM | ThirdParty)
         # Check that the compiler directory can be found
         [ -d "$clangDir" ] || {
             echo 1>&2
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+            echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
             echo "    Cannot find $clangDir installation." 1>&2
             echo "    Please install this compiler version or if you wish to" \
                  " use the system compiler," 1>&2
@@ -383,7 +383,7 @@ SYSTEMOPENMPI)
 OPENMPI)
     export FOAM_MPI=openmpi-1.10.0
     # Optional configuration tweaks:
-    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.sh`
+    _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/openmpi`
 
     export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
 
@@ -405,7 +405,7 @@ SYSTEMMPI)
     if [ -z "$MPI_ROOT" ]
     then
         echo 1>&2
-        echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+        echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
         echo "    Please set the environment variable MPI_ROOT to point to" \
              " the base folder for the system MPI in use." 1>&2
         echo "    Example:" 1>&2
@@ -418,7 +418,7 @@ SYSTEMMPI)
         if [ -z "$MPI_ARCH_FLAGS" ]
         then
             echo 1>&2
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+            echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
             echo "    MPI_ARCH_FLAGS is not set. Example:" 1>&2
             echo 1>&2
             echo "        export MPI_ARCH_FLAGS=\"-DOMPI_SKIP_MPICXX\"" 1>&2
@@ -428,7 +428,7 @@ SYSTEMMPI)
         if [ -z "$MPI_ARCH_INC" ]
         then
             echo 1>&2
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+            echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
             echo "    MPI_ARCH_INC is not set. Example:" 1>&2
             echo 1>&2
             echo "        export MPI_ARCH_INC=\"-isystem \$MPI_ROOT/include\"" 1>&2
@@ -438,7 +438,7 @@ SYSTEMMPI)
         if [ -z "$MPI_ARCH_LIBS" ]
         then
             echo 1>&2
-            echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+            echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
             echo "    MPI_ARCH_LIBS is not set. Example:" 1>&2
             echo 1>&2
             echo "        export MPI_ARCH_LIBS=\"-L\$MPI_ROOT/lib -lmpi\"" 1>&2
@@ -532,7 +532,7 @@ SGIMPI)
 
     if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
     then
-        echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+        echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
         echo "    MPI_ROOT not a valid mpt installation directory or ending" \
              " in a '/'." 1>&2
         echo "    Please set MPI_ROOT to the mpt installation directory." 1>&2
@@ -559,7 +559,7 @@ INTELMPI)
 
     if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
     then
-        echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
+        echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
         echo "    MPI_ROOT not a valid mpt installation directory or ending" \
              " in a '/'." 1>&2
         echo "    Please set MPI_ROOT to the mpt installation directory." 1>&2
diff --git a/etc/config/unset.sh b/etc/config.sh/unset
similarity index 97%
rename from etc/config/unset.sh
rename to etc/config.sh/unset
index 59428c5d6b..11394486db 100644
--- a/etc/config/unset.sh
+++ b/etc/config.sh/unset
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2013 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -22,7 +22,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # File
-#     etc/config/unset.sh
+#     etc/config.sh/unset
 #
 # Description
 #     Clear as many OpenFOAM environment settings as possible
diff --git a/etc/config/README b/etc/config/README
deleted file mode 100644
index b63135f141..0000000000
--- a/etc/config/README
+++ /dev/null
@@ -1,54 +0,0 @@
-The main OpenFOAM settings are located in the parent etc/ directory
-
-* bashrc, cshrc
-  entry point for sourcing
-
-* prefs.csh, prefs.sh
-  these files are untracked and can be used for some site-defined
-  settings
-
-
-The etc/config/ directory contains various configuration files in
-sh/csh variants:
-
-* settings.csh, settings.sh
-  core settings
-
-* aliases.csh, aliases.sh
-  aliases for interactive shells
-
-* unset.csh, unset.sh
-  sourced to clear as many OpenFOAM environment settings as possible
-
-
-* ensight.csh, ensight.sh
-  application settings for EnSight
-
-* paraview.csh, paraview.sh
-  application settings for ParaView
-
-* scotch.sh
-  application settings for compiling against scotch
-
-* metis.sh
-  application settings for compiling against metis 5
-
----
-
-The config/example directory contains various example configuration files
-in sh/csh variants
-
-* compiler.csh, compiler.sh
-  an example of fine tuning ThirdParty compiler settings for OpenFOAM
-
-* openmpi.csh, openmpi.sh
-  an example of fine tuning openmpi settings for OpenFOAM
-
-* paraview.csh, paraview.sh
-  an example of chaining to the standard config/paraview.sh with a
-  different ParaView_VERSION
-
-* prefs.csh, prefs.sh
-  an example of supplying alternative site-defined settings
-
----
diff --git a/etc/cshrc b/etc/cshrc
index e1a6ada091..39ee93d9a7 100644
--- a/etc/cshrc
+++ b/etc/cshrc
@@ -2,7 +2,7 @@
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2011-2015 OpenFOAM Foundation
+#   \\  /    A nd           | Copyright (C) 2011-2016 OpenFOAM Foundation
 #    \\/     M anipulation  |
 #------------------------------------------------------------------------------
 # License
@@ -202,14 +202,14 @@ if ( $status == 0 ) setenv MANPATH $cleaned
 
 # Source project setup files
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
-_foamSource $WM_PROJECT_DIR/etc/config/settings.csh
-_foamSource $WM_PROJECT_DIR/etc/config/aliases.csh
+_foamSource $WM_PROJECT_DIR/etc/config.csh/settings
+_foamSource $WM_PROJECT_DIR/etc/config.csh/aliases
 
 # Source user setup files for optional packages
 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/paraview.csh`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/ensight.csh`
-_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/CGAL.csh`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/paraview`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/ensight`
+_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.csh/CGAL`
 
 
 # Clean environment paths again. Only remove duplicates
-- 
GitLab