diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index e27494ba..d645e63d 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -315,3 +315,40 @@ 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 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 + + export MODULEPATH=init/modules + # Set the relevant environment variable, load the EESSI module, and grep for what we expect in PS1 + export EESSI_MODULE_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" + echo "$PS1" | grep "$GREP_PATTERN" diff --git a/init/modules/EESSI/2023.06.lua b/init/modules/EESSI/2023.06.lua index 5898bfb8..3ae13bbd 100644 --- a/init/modules/EESSI/2023.06.lua +++ b/init/modules/EESSI/2023.06.lua @@ -214,13 +214,26 @@ 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) +local quiet_load = false +if os.getenv("EESSI_MODULE_UPDATE_PS1") then + 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