File tree Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Expand file tree Collapse file tree 2 files changed +70
-0
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,23 @@ function check_arch() {
168168 fi
169169}
170170
171+ function update_lmod_caches() {
172+ # Update the Lmod caches for the stacks of all supported CPUs
173+ script_dir=$( dirname $( realpath $BASH_SOURCE ) )
174+ update_caches_script=${script_dir} /update_lmod_caches.sh
175+ if [ ! -f ${update_caches_script} ]
176+ then
177+ error " cannot find the script for updating the Lmod caches; it should be placed in the same directory as the ingestion script!"
178+ fi
179+ if [ ! -x ${update_caches_script} ]
180+ then
181+ error " the script for updating the Lmod caches (${update_caches_script} ) does not have execute permissions!"
182+ fi
183+ cvmfs_server transaction " ${repo} "
184+ ${update_caches_script} /cvmfs/${repo} /${basedir} /${version}
185+ cvmfs_server publish -m " update Lmod caches after ingesting ${tar_file_basename} " " ${repo} "
186+ }
187+
171188function ingest_init_tarball() {
172189 # Handle the ingestion of tarballs containing init scripts
173190 cvmfs_ingest_tarball
@@ -183,6 +200,7 @@ function ingest_software_tarball() {
183200 check_arch
184201 check_os
185202 cvmfs_ingest_tarball
203+ update_lmod_caches
186204}
187205
188206function ingest_compat_tarball() {
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ function echo_green() {
4+ echo -e " \e[32m$1 \e[0m"
5+ }
6+
7+ function echo_red() {
8+ echo -e " \e[31m$1 \e[0m"
9+ }
10+
11+ function error() {
12+ echo_red " ERROR: $1 " >&2
13+ exit 1
14+ }
15+
16+ # Check if a stack base dir has been specified
17+ if [ " $# " -ne 1 ]; then
18+ error " usage: $0 <path to main directory of an EESSI stack>"
19+ fi
20+
21+ stack_base_dir=" $1 "
22+
23+ # Check if the given stack base dir exists
24+ if [ ! -d ${stack_base_dir} ]
25+ then
26+ error " ${stack_base_dir} does not point to an existing directory!"
27+ fi
28+
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"
31+ if [ ! -f ${update_lmod_system_cache_files} ]
32+ then
33+ error " expected to find Lmod's cache update script at ${update_lmod_system_cache_files} , but it doesn't exist."
34+ fi
35+
36+ # Find all subtrees of supported CPU targets by looking for "modules" directories, and taking their parent directory
37+ architectures=$( find ${stack_base_dir} /software/ -maxdepth 5 -type d -name modules -exec dirname {} \; )
38+
39+ # Create/update the Lmod cache for all architectures
40+ for archdir in ${architectures}
41+ do
42+ lmod_cache_dir=" ${archdir} /.lmod/cache"
43+ ${update_lmod_system_cache_files} -d ${lmod_cache_dir} -t ${lmod_cache_dir} /timestamp ${archdir} /modules/all
44+ exit_code=$?
45+ if [[ ${exit_code} -eq 0 ]]; then
46+ echo_green " Updated the Lmod cache for ${archdir} ."
47+ ls -lrt ${lmod_cache_dir}
48+ else
49+ echo_red " Updating the Lmod cache failed for ${archdir} ."
50+ exit ${exit_code}
51+ fi
52+ done
You can’t perform that action at this time.
0 commit comments