From 86b037ae7c68e3bcde6d143f1db173036483285f Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Fri, 14 Sep 2018 11:29:17 +0200
Subject: [PATCH] [CMake] Eve module Lmod syntax.

---
 Jenkinsfile                                   |  2 ++
 scripts/cmake/packaging/PackagingLinux.cmake  |  8 +++----
 scripts/cmake/packaging/module.in             | 23 +++++++++++++++----
 .../docs/quickstart/basics/envinf1.pandoc     |  2 +-
 4 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index d585c2c6a5f..bc708bb7bfb 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -393,6 +393,7 @@ pipeline {
           agent { label "envinf1"}
           steps {
             script {
+              sh 'rm -rf /global/apps/ogs/head/standard'
               configure {
                 cmakeOptions =
                   '-DOGS_BUILD_UTILS=ON ' +
@@ -419,6 +420,7 @@ pipeline {
           agent { label "envinf1"}
           steps {
             script {
+              sh 'rm -rf /global/apps/ogs/head/petsc'
               configure {
                 cmakeOptions =
                   '-DOGS_USE_PETSC=ON ' +
diff --git a/scripts/cmake/packaging/PackagingLinux.cmake b/scripts/cmake/packaging/PackagingLinux.cmake
index 00ad219f2a8..124610ce591 100644
--- a/scripts/cmake/packaging/PackagingLinux.cmake
+++ b/scripts/cmake/packaging/PackagingLinux.cmake
@@ -10,17 +10,17 @@ if(MODULE_CMD)
     string(REPLACE "\n" ";" MODULE_LIST_OUTPUT ${MODULE_LIST_OUTPUT})
     foreach(line ${MODULE_LIST_OUTPUT})
         if(NOT line STREQUAL "Currently Loaded Modulefiles:")
-            set(MODULE_LOAD_STRING "${MODULE_LOAD_STRING}module load ${line}\n")
+            set(MODULE_LOAD_STRING "${MODULE_LOAD_STRING}load(\"${line}\")\n")
         endif()
     endforeach()
     configure_file(${PROJECT_SOURCE_DIR}/scripts/cmake/packaging/module.in
-        ${PROJECT_BINARY_DIR}/module
+        ${PROJECT_BINARY_DIR}/module.lua
     )
     if(OGS_MODULEFILE)
         get_filename_component(MODULE_DIR ${OGS_MODULEFILE} DIRECTORY)
         get_filename_component(MODULE_NAME ${OGS_MODULEFILE} NAME)
-        install(FILES ${PROJECT_BINARY_DIR}/module DESTINATION ${MODULE_DIR}
-            RENAME ${MODULE_NAME})
+        install(FILES ${PROJECT_BINARY_DIR}/module.lua DESTINATION ${MODULE_DIR}
+            RENAME ${MODULE_NAME}.lua)
     endif()
 endif()
 
diff --git a/scripts/cmake/packaging/module.in b/scripts/cmake/packaging/module.in
index 3d0aec8bd8e..b595d85d5d2 100644
--- a/scripts/cmake/packaging/module.in
+++ b/scripts/cmake/packaging/module.in
@@ -1,8 +1,23 @@
-#%Module1.0
+help([==[
 
-module-whatis OpenGeoSys @OGS_VERSION@
-conflict ogs
+Description
+===========
+OpenGeoSys (OGS) is a scientific open source project for the development of
+ numerical methods for the simulation of thermo-hydro-mechanical-chemical
+ (THMC) processes in porous and fractured media.
+
+
+More information
+================
+ - Homepage: https://opengeosys.org
+]==])
+whatis([==[Name: OpenGeoSys]==])
+whatis([==[Version: @OGS_VERSION@]==])
+
+conflict("ogs")
 
 @MODULE_LOAD_STRING@
 
-prepend-path PATH @CMAKE_INSTALL_PREFIX@/bin
+local root = "@CMAKE_INSTALL_PREFIX@"
+
+prepend_path("PATH", pathJoin(root, "bin"))
diff --git a/web/content/docs/quickstart/basics/envinf1.pandoc b/web/content/docs/quickstart/basics/envinf1.pandoc
index bfe0008ea88..b1755ac4689 100644
--- a/web/content/docs/quickstart/basics/envinf1.pandoc
+++ b/web/content/docs/quickstart/basics/envinf1.pandoc
@@ -18,7 +18,7 @@ Members of the Department Environmental Informatics of the Helmholtz Centre for
 You select an OGS version by loading a module:
 
 ```bash
-export MODULEPATH=$MODULEPATH:/global/apps/modulefiles
+module use /global/apps/modulefiles
 
 # Examples:
 module load ogs            # Loads latest (maybe unstable) ogs in standard config
-- 
GitLab