Skip to content

Commit

Permalink
Merge branch 'mount_overlay-upper_read-only' of github-trz:trz42/soft…
Browse files Browse the repository at this point in the history
…ware-layer into test_550_with_GROMACS_rebuild_in_576
  • Loading branch information
truib committed May 15, 2024
2 parents 792ea3e + 08f8854 commit 28739c4
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions eessi_container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,47 @@ declare -a EESSI_FUSE_MOUNTS=()
# always mount cvmfs-config repo (to get access to software.eessi.io)
EESSI_FUSE_MOUNTS+=("--fusemount" "container:cvmfs2 cvmfs-config.cern.ch /cvmfs/cvmfs-config.cern.ch")

# check if we got some data via --resume and, if so, use the overlayfs
# example scenario:
# 1st step: some software is build in rw mode
# 2nd step: the software is tested in ro mode (same access as when we would use a
# repository)
if [[ "${ACCESS}" == "ro" ]]; then
export EESSI_READONLY="container:cvmfs2 ${repo_name} /cvmfs/${repo_name}"
if [[ -d ${EESSI_TMPDIR}/overlay-upper ]]; then
# the overlay-upper directory is only created in a read-write-session, thus
# we are resuming from such a session here (otherwise there shouldn't be such
# directory yet as it is only created for read-write-sessions a bit further
# below); the overlay-upper directory can only exist because it is part of
# the ${RESUME} directory or tarball
# to be able to see the contents of the read-write session we have to mount
# the fuse-overlayfs (in read-only mode) on top of the CernVM-FS repository

# make sure the overlay-upper directory exists
mkdir -p ${EESSI_TMPDIR}/overlay-upper

# make the target CernVM-FS repository available under /cvmfs_ro
export EESSI_READONLY="container:cvmfs2 ${repo_name} /cvmfs_ro/${repo_name}"

EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")

# now, put the overlay-upper read-only on top of the repo and make it under the usual prefix /cvmfs available
EESSI_READONLY_OVERLAY="container:fuse-overlayfs"
# ${EESSI_TMPDIR} is bind mounted to /tmp, hence ${EESSI_TMPDIR}/overlay-upper becomes available as /tmp/overlay-upper
# the left-most lower dir is put on top, with no upperdir=... the whole overlayfs is made available read-only
EESSI_READONLY_OVERLAY+=" -o lowerdir=/tmp/overlay-upper:/cvmfs_ro/${repo_name}"
EESSI_READONLY_OVERLAY+=" ${EESSI_CVMFS_REPO}"
export EESSI_READONLY_OVERLAY

EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY_OVERLAY}")
export EESSI_FUSE_MOUNTS
else
# no overlay-upper directory means we are in a plain read-only session and
# don't need any fuse-overlayfs
export EESSI_READONLY="container:cvmfs2 ${repo_name} /cvmfs/${repo_name}"

EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")
export EESSI_FUSE_MOUNTS
EESSI_FUSE_MOUNTS+=("--fusemount" "${EESSI_READONLY}")
export EESSI_FUSE_MOUNTS
fi
fi

if [[ "${ACCESS}" == "rw" ]]; then
Expand Down

0 comments on commit 28739c4

Please sign in to comment.