Skip to content

Commit dd1ce43

Browse files
committed
allow overriding of the Lmod cache update script location
1 parent 5fa16cd commit dd1ce43

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

scripts/update_lmod_caches.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,24 @@ function error() {
1414
}
1515

1616
# Check if a stack base dir has been specified
17-
if [ "$#" -ne 1 ]; then
17+
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
1818
error "usage: $0 <path to main directory of an EESSI stack>"
1919
fi
2020

2121
stack_base_dir="$1"
22+
update_lmod_system_cache_files="$2"
2223

2324
# Check if the given stack base dir exists
2425
if [ ! -d ${stack_base_dir} ]
2526
then
2627
error "${stack_base_dir} does not point to an existing directory!"
2728
fi
2829

29-
# Check if Lmod's cache update script can be found at the expected location (in the compatibility layer of the given stack)
30-
update_lmod_system_cache_files="${stack_base_dir}/compat/linux/$(uname -m)/usr/share/Lmod/libexec/update_lmod_system_cache_files"
30+
# If no Lmod cache update script was specified, try to find one in the compatibility layer of the given stack
31+
if [ -z ${update_lmod_system_cache_files} ]; then
32+
update_lmod_system_cache_files="${stack_base_dir}/compat/linux/$(uname -m)/usr/share/Lmod/libexec/update_lmod_system_cache_files"
33+
fi
34+
# Make sure that the expected Lmod cache update script exists
3135
if [ ! -f ${update_lmod_system_cache_files} ]
3236
then
3337
error "expected to find Lmod's cache update script at ${update_lmod_system_cache_files}, but it doesn't exist."

0 commit comments

Comments
 (0)