Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Add script for updating the base stack Lmod cache #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions scripts/update_lmod_cache_cvmfs_base.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

source $(dirname $(realpath $0))/stack.cfg

CONTAINER="docker://ghcr.io/rug-cit-hpc/build-node:${os}"

# Generate base module cache
DOT_LMOD="${stack_base_std}/.lmod"
LMOD_RC="${stack_base_std}/.lmod/lmodrc.lua"

apptainer shell -B /cvmfs ${CONTAINER} <<EOF
modulefiles=\$(find ${stack_base_std}/modules -name "*.lua" | grep -v StdEnv)
for modulefile in \${modulefiles}
do
echo \${modulefile}
done

if [ ! -d "${DOT_LMOD}" ]
then
mkdir -p "${DOT_LMOD}/cache"
fi

if [ ! -f "${LMOD_RC}" ]
then
cat > "${LMOD_RC}" <<LMODRCEOF
propT = {
}
scDescriptT = {
{
["dir"] = "${DOT_LMOD}/cache",
["timestamp"] = "${DOT_LMOD}/cache/timestamp",
},
}
LMODRCEOF
fi

ls ${stack_base_std}/modules
MODULEPATH=${stack_base_std}/modules
echo "Using MODULEPATH: \${MODULEPATH}"
/usr/share/lmod/lmod/libexec/update_lmod_system_cache_files -d ${DOT_LMOD}/cache -t ${DOT_LMOD}/cache/timestamp \$MODULEPATH

EOF