From b62841239c67b28fec49ee53977fc5e46037dbdc Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 22 Apr 2021 09:48:27 +0200 Subject: [PATCH] modulecmd: bugfix in use/unuse overlay - Since Pmodules itself can be loaded as module, it must be possible to add/remove overlays if no modules are loaded or only a Pmodules module. --- Pmodules/modulecmd.bash.in | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 70b2079..020f225 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1323,7 +1323,7 @@ subcommand_use() { use () { use_overlay() { - if [[ -n "${_LMFILES_}" ]]; then + if [[ -n "${_LMFILES_}" ]] && [[ ${LOADEDMODULES} != Pmodules/* ]]; then std::die 3 "%s %s: %s -- %s" \ "${CMD}" "${subcommand}" \ "overlays can be added as long as no modules are loaded!" \ @@ -1529,12 +1529,11 @@ subcommand_unuse() { unuse() { unuse_overlay() { - [[ -n "${_LMFILES_}" ]] && \ - std::die 3 "%s %s: %s -- %s" \ + if [[ -n "${_LMFILES_}" ]] && [[ ${LOADEDMODULES} != Pmodules/* ]]; then std::die 3 "%s %s: %s -- %s" \ "${CMD}" "${subcommand}" \ - "overlays can be removed as long as modules are loaded!" \ + "overlays can NOT be removed as long as modules are loaded!" \ "${overlay}" - + fi overlay=${overlay%:*} # ignore any modifier overlay=${overlay%/} # remove trailing '/' if there is one [[ -d "${overlay}" ]] || \