From ffbb4f29f9da993e51e9e5a679a098acf0fb30ff Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 30 Jan 2026 13:38:50 +0100 Subject: [PATCH 1/8] Add capability to update PS1 when loading the EESSI module --- init/modules/EESSI/2023.06.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/init/modules/EESSI/2023.06.lua b/init/modules/EESSI/2023.06.lua index 5898bfb8..79c51d54 100644 --- a/init/modules/EESSI/2023.06.lua +++ b/init/modules/EESSI/2023.06.lua @@ -214,6 +214,15 @@ if family_name then family(family_name) end +-- change the PS1 if it exists to indicate you have EESSI loaded +-- (doesn't help with a csh or fish prompt, but we just live with that) +if os.getenv("EESSI_UPDATE_PS1") then + prompt = os.getenv("PS1") + if prompt then + pushenv("PS1", "{EESSI/" .. eessi_version .. "} " .. prompt) + end +end + -- allow sites to make the EESSI module sticky by defining EESSI_MODULE_STICKY (to any value) load_message = "Module for EESSI/" .. eessi_version .. " loaded successfully" if os.getenv("EESSI_MODULE_STICKY") then From 23ded08cae47edf5cbf2f1916c15cb4399f52055 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 30 Jan 2026 13:47:33 +0100 Subject: [PATCH 2/8] Add a test for EESSI_UPDATE_PS1 --- .github/workflows/tests_eessi_module.yml | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index e27494ba..beac15d6 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -315,3 +315,34 @@ jobs: module load "EESSI/${{matrix.EESSI_VERSION}}" GREP_PATTERN="Lmod is automatically replacing \"EESSI/${{matrix.EESSI_VERSION}}\" with \"${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}\"." module load "${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}" |& grep "${GREP_PATTERN}" + + check_PS1_update_eessi_module: + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + EESSI_VERSION: + - '2023.06' + - '2025.06' + + steps: + - name: Check out software-layer repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Mount EESSI CernVM-FS repository + uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 + with: + cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb + cvmfs_http_proxy: DIRECT + cvmfs_repositories: software.eessi.io + + - name: Make sure we can use the EESSI_UPDATE_PS1 to update PS1 in the EESSI module + run: | + # Initialise Lmod + . /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash + + # Set the relevant environment variable, load the EESSI module, and grep for what we expect in PS1 + export EESSI_UPDATE_PS1=1 + module load "EESSI/${{matrix.EESSI_VERSION}}" + GREP_PATTERN="{EESSI/${{matrix.EESSI_VERSION}} " + grep -F -- "${PS1}" "${GREP_PATTERN}" \ No newline at end of file From 137e1f56fe7ad83d06e2580fdce1fec8e3179bf2 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Fri, 30 Jan 2026 13:53:30 +0100 Subject: [PATCH 3/8] Update tests_eessi_module.yml --- .github/workflows/tests_eessi_module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index beac15d6..2663cfc0 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -345,4 +345,4 @@ jobs: export EESSI_UPDATE_PS1=1 module load "EESSI/${{matrix.EESSI_VERSION}}" GREP_PATTERN="{EESSI/${{matrix.EESSI_VERSION}} " - grep -F -- "${PS1}" "${GREP_PATTERN}" \ No newline at end of file + grep -F -- "${PS1}" "${GREP_PATTERN}" From 2af3ff52cb97bab3d9096adbedb77fa80214344c Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 30 Jan 2026 14:01:21 +0100 Subject: [PATCH 4/8] Forgot to set MODULEPATH --- .github/workflows/tests_eessi_module.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index beac15d6..ab1c7731 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -341,8 +341,9 @@ jobs: # Initialise Lmod . /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash + export MODULEPATH=init/modules # Set the relevant environment variable, load the EESSI module, and grep for what we expect in PS1 export EESSI_UPDATE_PS1=1 module load "EESSI/${{matrix.EESSI_VERSION}}" GREP_PATTERN="{EESSI/${{matrix.EESSI_VERSION}} " - grep -F -- "${PS1}" "${GREP_PATTERN}" \ No newline at end of file + grep -F -- "${PS1}" "${GREP_PATTERN}" From c6e1639e85e1d353866c975243b23c1d084d2f88 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 30 Jan 2026 14:10:25 +0100 Subject: [PATCH 5/8] Pipe the variable to check it with grep --- .github/workflows/tests_eessi_module.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index ab1c7731..fd2bf074 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -345,5 +345,6 @@ jobs: # Set the relevant environment variable, load the EESSI module, and grep for what we expect in PS1 export EESSI_UPDATE_PS1=1 module load "EESSI/${{matrix.EESSI_VERSION}}" - GREP_PATTERN="{EESSI/${{matrix.EESSI_VERSION}} " - grep -F -- "${PS1}" "${GREP_PATTERN}" + GREP_PATTERN="{EESSI/${{matrix.EESSI_VERSION}}} " + # Pipe the PS1 variable into grep to check for the pattern + echo "$PS1" | grep -F -- "$GREP_PATTERN" From 101f1e528b650bf4859540fcd2ddc778eec4203e Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 30 Jan 2026 14:16:26 +0100 Subject: [PATCH 6/8] Manually set PS1 in the test for non-interactive shell --- .github/workflows/tests_eessi_module.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index fd2bf074..eabc8cbb 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -336,7 +336,7 @@ jobs: cvmfs_http_proxy: DIRECT cvmfs_repositories: software.eessi.io - - name: Make sure we can use the EESSI_UPDATE_PS1 to update PS1 in the EESSI module + - name: Make sure we can use EESSI_UPDATE_PS1 to update PS1 in the EESSI module run: | # Initialise Lmod . /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash @@ -344,7 +344,11 @@ jobs: export MODULEPATH=init/modules # Set the relevant environment variable, load the EESSI module, and grep for what we expect in PS1 export EESSI_UPDATE_PS1=1 + # Need to set PS1 manually as we are in a non-interactive shell + export PS1="mytest $" + echo $PS1 module load "EESSI/${{matrix.EESSI_VERSION}}" GREP_PATTERN="{EESSI/${{matrix.EESSI_VERSION}}} " # Pipe the PS1 variable into grep to check for the pattern - echo "$PS1" | grep -F -- "$GREP_PATTERN" + echo "$PS1" + echo "$PS1" | grep "$GREP_PATTERN" From 5ecd4393ee02e0fa33537a35630e87b652055103 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 30 Jan 2026 16:22:53 +0100 Subject: [PATCH 7/8] Use consistent naming for environment variables that affect the EESSI module --- .github/workflows/tests_eessi_module.yml | 2 +- init/modules/EESSI/2023.06.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index eabc8cbb..d645e63d 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -343,7 +343,7 @@ jobs: export MODULEPATH=init/modules # Set the relevant environment variable, load the EESSI module, and grep for what we expect in PS1 - export EESSI_UPDATE_PS1=1 + export EESSI_MODULE_UPDATE_PS1=1 # Need to set PS1 manually as we are in a non-interactive shell export PS1="mytest $" echo $PS1 diff --git a/init/modules/EESSI/2023.06.lua b/init/modules/EESSI/2023.06.lua index 79c51d54..33caa5e0 100644 --- a/init/modules/EESSI/2023.06.lua +++ b/init/modules/EESSI/2023.06.lua @@ -216,7 +216,7 @@ end -- change the PS1 if it exists to indicate you have EESSI loaded -- (doesn't help with a csh or fish prompt, but we just live with that) -if os.getenv("EESSI_UPDATE_PS1") then +if os.getenv("EESSI_MODULE_UPDATE_PS1") then prompt = os.getenv("PS1") if prompt then pushenv("PS1", "{EESSI/" .. eessi_version .. "} " .. prompt) From 256b70d1b4d683386ef3f16febf0527d4e190426 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Mon, 2 Feb 2026 10:40:08 +0100 Subject: [PATCH 8/8] If I change the prompt, make the load silent --- init/modules/EESSI/2023.06.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/init/modules/EESSI/2023.06.lua b/init/modules/EESSI/2023.06.lua index 33caa5e0..3ae13bbd 100644 --- a/init/modules/EESSI/2023.06.lua +++ b/init/modules/EESSI/2023.06.lua @@ -216,20 +216,24 @@ end -- change the PS1 if it exists to indicate you have EESSI loaded -- (doesn't help with a csh or fish prompt, but we just live with that) +local quiet_load = false if os.getenv("EESSI_MODULE_UPDATE_PS1") then - prompt = os.getenv("PS1") + local prompt = os.getenv("PS1") if prompt then + quiet_load = true pushenv("PS1", "{EESSI/" .. eessi_version .. "} " .. prompt) end end -- allow sites to make the EESSI module sticky by defining EESSI_MODULE_STICKY (to any value) -load_message = "Module for EESSI/" .. eessi_version .. " loaded successfully" +local load_message = "Module for EESSI/" .. eessi_version .. " loaded successfully" if os.getenv("EESSI_MODULE_STICKY") then add_property("lmod","sticky") load_message = load_message .. " (requires '--force' option to unload or purge)" end if mode() == "load" then - LmodMessage(load_message) + if not quiet_load then + LmodMessage(load_message) + end end