From 2b783790df9a4513e9084ff68ac7af9c0f9724cb Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Wed, 24 Jun 2026 17:05:25 +0200 Subject: [PATCH 1/2] Create a generic way with which to prefix env vars so that they are propagated into the startprefix environment --- run_in_compat_layer_env.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/run_in_compat_layer_env.sh b/run_in_compat_layer_env.sh index 98b9b211..1b27ef71 100755 --- a/run_in_compat_layer_env.sh +++ b/run_in_compat_layer_env.sh @@ -66,6 +66,22 @@ if [ ! -z ${EESSI_SITE_INSTALL_FORCE} ]; then fi fi +# The above propagates some hard-coded environment variables into the prefix environment +# Here, we provide a mechanism that propagates ANY variable named PROPAGATE_INTO_PREFIX_ +# into the prefix environment as "export =" +# Example: PROPAGATE_INTO_PREFIX_FOO=bar => export FOO=bar +while IFS='=' read -r var_name var_value; do + # Only act on variables that start with the marker prefix + if [[ ${var_name} == PROPAGATE_INTO_PREFIX_* ]]; then + # Strip the marker prefix to obtain the target name + target_name=${var_name#PROPAGATE_INTO_PREFIX_} + # Guard against empty target names + if [[ -n ${target_name} ]]; then + INPUT="export ${target_name}=${var_value}; ${INPUT}" + fi + fi +done < <(env) # feed the current environment to the while‑loop + echo "Running '${INPUT}' in EESSI (${EESSI_CVMFS_REPO}) ${EESSI_VERSION} compatibility layer environment..." ${EESSI_COMPAT_LAYER_DIR}/startprefix <<< "${INPUT}" From 6cad6d32dbdfd29d5a968c2733d60f19cdd16c04 Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Wed, 24 Jun 2026 17:14:05 +0200 Subject: [PATCH 2/2] Now even more specific --- run_in_compat_layer_env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run_in_compat_layer_env.sh b/run_in_compat_layer_env.sh index 1b27ef71..07501a7c 100755 --- a/run_in_compat_layer_env.sh +++ b/run_in_compat_layer_env.sh @@ -72,9 +72,9 @@ fi # Example: PROPAGATE_INTO_PREFIX_FOO=bar => export FOO=bar while IFS='=' read -r var_name var_value; do # Only act on variables that start with the marker prefix - if [[ ${var_name} == PROPAGATE_INTO_PREFIX_* ]]; then + if [[ ${var_name} == EESSI_PROPAGATE_INTO_PREFIX_* ]]; then # Strip the marker prefix to obtain the target name - target_name=${var_name#PROPAGATE_INTO_PREFIX_} + target_name=${var_name#EESSI_PROPAGATE_INTO_PREFIX_} # Guard against empty target names if [[ -n ${target_name} ]]; then INPUT="export ${target_name}=${var_value}; ${INPUT}"