Skip to content

Additional tweaks for Lmod-based init scripts #178

@ocaisa

Description

@ocaisa

There are a few things that can be done to further improve the Lmod-based init scripts.

  • Make the bash, zsh and ksh initialisation scripts POSIX compliant
    • This would also allow us to have a unique script with symlinks for the others (including a new sh variant which should also work with dash). The only thing that is unique to each script is the name of the shell, since the script is (typically) sourced $0 is the name of the current shell (with potentially a leading -). We need the shell to know what initialisation script to use from Lmod. It should be possible to store the shell as $(basename -- ${0#-}) which will work for both source and direct execution since the filename and shell are meant to be the same (and even better, for a sourced script it will be forgiving even if you call the "wrong" script). dash would need to be special-cased (dash -> sh).
  • Currently, if you follow the sequence
    ocaisa@~$ source /cvmfs/software.eessi.io/versions/2025.06/init/lmod/bash
    Modules purged before initialising EESSI
    Module for EESSI/2025.06 loaded successfully
    EESSI has selected aarch64/neoverse_n1 as the compatible CPU target for EESSI/2025.06
    EESSI did not identify an accelerator on the system
    (for debug information when loading the EESSI module, set the environment variable EESSI_MODULE_DEBUG_INIT)
    {EESSI/2025.06} ocaisa@~$ source /cvmfs/software.eessi.io/versions/2023.06/init/lmod/bash
    Running "module reset". Resetting modules to system default. The following $MODULEPATH directories have been removed: None
    Module for EESSI/2025.06 loaded successfully
    {EESSI/2025.06} ocaisa@~$
    
    you end up with the "wrong" EESSI version loaded as EESSI_VERSION was set when you called the second script (which is an override variable). This needs to be special cased.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions