modulecmd: use_overlay() improve code for overlays of type replacing

This commit is contained in:
2021-12-09 17:52:09 +01:00
parent 363b6d4353
commit 4bc94c519c
+8 -8
View File
@@ -1448,18 +1448,18 @@ subcommand_use() {
esac
if [[ "${ol_type}" == "${ol_replacing}" ]]; then
# if this overlay replaces groups, we have to remove
# the modules made available by other overlays in these groups
# if this overlay replaces groups, we have
# to remove the modules made available by
# other overlays in these groups
for group in ${UsedGroups//:/ }; do
# first test whether this group is in the to be added overlay
# is this group in the to be added overlay?
local dir="${ol_dir}/"
dir+="${group}/${PMODULES_MODULEFILES_DIR}"
[[ -d "${dir}" ]] || continue # no
for dir in "${OverlayList[@]}"; do
dir+="/${group}/${PMODULES_MODULEFILES_DIR}"
std::remove_path MODULEPATH "${dir}"
done
dir="/${group}/${PMODULES_MODULEFILES_DIR}"
local -a dirs=( "${OverlayList[@]/%/${dir}}" )
std::remove_path MODULEPATH "${dirs[@]}"
done
fi