forked from EESSI/software-layer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
update_lmod_cache.sh
executable file
·37 lines (29 loc) · 1.04 KB
/
update_lmod_cache.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#
# Script to update Lmod cache in EESSI
#
TOPDIR=$(dirname $(realpath $0))
source $TOPDIR/scripts/utils.sh
if [ $# -ne 2 ]; then
echo "Usage: $0 <path to compat layer directory> <path to software installation prefix>" >&2
exit 1
fi
EPREFIX=$1
EASYBUILD_INSTALLPATH=$2
if [ ! -d $EPREFIX ]; then
echo "\$EPREFIX does not exist!" >&2
exit 2
fi
if [ ! -d $EASYBUILD_INSTALLPATH ]; then
echo "\$EASYBUILD_INSTALLPATH does not exist!" >&2
exit 2
fi
source $EPREFIX/usr/share/Lmod/init/bash
# we need to specify the path to the Lmod cache dir + timestamp file to ensure
# that update_lmod_system_cache_files updates correct Lmod cache
lmod_cache_dir=${EASYBUILD_INSTALLPATH}/.lmod/cache
lmod_cache_timestamp_file=${EASYBUILD_INSTALLPATH}/.lmod/cache/timestamp
modpath=${EASYBUILD_INSTALLPATH}/modules/all
${LMOD_DIR}/update_lmod_system_cache_files -d ${lmod_cache_dir} -t ${lmod_cache_timestamp_file} ${modpath}
check_exit_code $? "Lmod cache updated" "Lmod cache update failed!"
ls -lrt ${EASYBUILD_INSTALLPATH}/.lmod/cache