diff --git a/bot/build.sh b/bot/build.sh index 91d9721515..f63ff38b79 100755 --- a/bot/build.sh +++ b/bot/build.sh @@ -103,10 +103,6 @@ echo "bot/build.sh: STORAGE='${STORAGE}'" # make sure ${STORAGE} exists mkdir -p ${STORAGE} -# Make sure ${STORAGE} gets bind-mounted -# This will make sure that any subsequent jobs that create dirs or files under STORAGE have access to it in the container -export SINGULARITY_BIND="${SINGULARITY_BIND},${STORAGE}" - # make sure the base tmp storage is unique JOB_STORAGE=$(mktemp --directory --tmpdir=${STORAGE} bot_job_tmp_XXX) echo "bot/build.sh: created unique base tmp storage directory at ${JOB_STORAGE}" @@ -295,9 +291,6 @@ else TARBALL_STEP_ARGS+=("--resume" "${REMOVAL_TMPDIR}") fi -# Make sure we define storage, so that the TMPDIR is set to this in eessi_container.sh -TARBALL_STEP_ARGS+=("--storage" "${STORAGE}") - timestamp=$(date +%s) # to set EESSI_VERSION we need to source init/eessi_defaults now source $software_layer_dir/init/eessi_defaults diff --git a/eessi_container.sh b/eessi_container.sh index fc97f9877c..1cbc6c1c8d 100755 --- a/eessi_container.sh +++ b/eessi_container.sh @@ -529,6 +529,15 @@ BIND_PATHS="${EESSI_CVMFS_VAR_LIB}:/var/lib/cvmfs,${EESSI_CVMFS_VAR_RUN}:/var/ru # provide a '/tmp' inside the container BIND_PATHS="${BIND_PATHS},${EESSI_TMPDIR}:${TMP_IN_CONTAINER}" + +# if TMPDIR is not empty and if TMP_IN_CONTAINER is not a prefix of TMPDIR, we need to add a bind mount for TMPDIR +if [[ ! -z ${TMPDIR} && ${TMP_IN_CONTAINER} != ${TMPDIR}* ]]; then + msg="TMPDIR is not empty (${TMPDIR}) and TMP_IN_CONTAINER (${TMP_IN_CONTAINER}) is not a prefix of TMPDIR:" + msg="${msg} adding bind mount for TMPDIR" + echo "${msg}" + BIND_PATHS="${BIND_PATHS},${TMPDIR}" +fi + if [[ ! -z ${EXTRA_BIND_PATHS} ]]; then BIND_PATHS="${BIND_PATHS},${EXTRA_BIND_PATHS}" fi