Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .github/workflows/tests_scripts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ on:
- build_container.sh
- install_software_layer.sh
- run_in_compat_layer_env.sh
- utils.sh
- update_lmod_cache.sh

pull_request:
branches:
Expand All @@ -14,6 +16,8 @@ on:
- build_container.sh
- install_software_layer.sh
- run_in_compat_layer_env.sh
- utils.sh
- update_lmod_cache.sh
jobs:
build:
runs-on: ubuntu-20.04
Expand Down
40 changes: 2 additions & 38 deletions EESSI-pilot-install-software.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,7 @@

TOPDIR=$(dirname $(realpath $0))

function echo_green() {
echo -e "\e[32m$1\e[0m"
}

function echo_red() {
echo -e "\e[31m$1\e[0m"
}

function echo_yellow() {
echo -e "\e[33m$1\e[0m"
}

function fatal_error() {
echo_red "ERROR: $1" >&2
exit 1
}

function check_exit_code {
ec=$1
ok_msg=$2
fail_msg=$3

if [[ $ec -eq 0 ]]; then
echo_green "${ok_msg}"
else
fatal_error "${fail_msg}"
fi
}
source $TOPDIR/utils.sh

# honor $TMPDIR if it is already defined, use /tmp otherwise
if [ -z $TMPDIR ]; then
Expand Down Expand Up @@ -339,16 +312,7 @@ if [ ! -f $LMOD_RC ]; then
check_exit_code $? "$LMOD_RC created" "Failed to create $LMOD_RC"
fi

# 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
$TOPDIR/update_lmod_cache.sh ${EPREFIX} ${EASYBUILD_INSTALLPATH}

echo ">> Checking for missing installations..."
ok_msg="No missing installations, party time!"
Expand Down
37 changes: 37 additions & 0 deletions update_lmod_cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash
#
# Script to update Lmod cache in EESSI
#

TOPDIR=$(dirname $(realpath $0))

source $TOPDIR/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
28 changes: 28 additions & 0 deletions utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function echo_green() {
echo -e "\e[32m$1\e[0m"
}

function echo_red() {
echo -e "\e[31m$1\e[0m"
}

function echo_yellow() {
echo -e "\e[33m$1\e[0m"
}

function fatal_error() {
echo_red "ERROR: $1" >&2
exit 1
}

function check_exit_code {
ec=$1
ok_msg=$2
fail_msg=$3

if [[ $ec -eq 0 ]]; then
echo_green "${ok_msg}"
else
fatal_error "${fail_msg}"
fi
}