@@ -747,7 +747,14 @@ declare -a EESSI_FUSE_MOUNTS=()
747747# mount cvmfs-config repo (to get access to EESSI repositories such as software.eessi.io) unless env var
748748# EESSI_DO_NOT_MOUNT_CVMFS_CONFIG_CERN_CH is defined
749749if [ -z ${EESSI_DO_NOT_MOUNT_CVMFS_CONFIG_CERN_CH+x} ]; then
750- EESSI_FUSE_MOUNTS+=(" --fusemount" " container:cvmfs2 cvmfs-config.cern.ch /cvmfs/cvmfs-config.cern.ch" )
750+ if cvmfs_config stat cvmfs-config.cern.ch ; then
751+ # if the system has the repo available just pass it through
752+ BIND_PATHS=" ${BIND_PATHS} ,/cvmfs/cvmfs-config.cern.ch:/cvmfs/cvmfs-config.cern.ch"
753+ else
754+ # otherwise use apptainer capabilities to make it available within the container
755+ EESSI_FUSE_MOUNTS+=(" --fusemount" " container:cvmfs2 cvmfs-config.cern.ch /cvmfs/cvmfs-config.cern.ch" )
756+ export EESSI_FUSE_MOUNTS
757+ fi
751758fi
752759
753760
795802 echo " session. Will use it as left-most directory in 'lowerdir' argument for fuse-overlayfs."
796803
797804 # make the target CernVM-FS repository available under /cvmfs_ro
798- export EESSI_READONLY=" container:cvmfs2 ${cvmfs_repo_name} /cvmfs_ro/${cvmfs_repo_name} "
799-
800- EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY} " )
805+ if cvmfs_config stat ${cvmfs_repo_name} ; then
806+ # if the system has the repo available just pass it through
807+ BIND_PATHS=" ${BIND_PATHS} ,/cvmfs/${cvmfs_repo_name} :/cvmfs_ro/${cvmfs_repo_name} "
808+ else
809+ # otherwise use apptainer capabilities to make it available within the container
810+ export EESSI_READONLY=" container:cvmfs2 ${cvmfs_repo_name} /cvmfs_ro/${cvmfs_repo_name} "
811+ EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY} " )
812+ fi
801813
802814 # now, put the overlay-upper read-only on top of the repo and make it available under the usual prefix /cvmfs
803815 if [[ " ${OVERLAY_TOOL} " == " fuse-overlayfs" ]]; then
827839 # basic "ro" access that doesn't require any fuseoverlay-fs
828840 echo " Mounting '${cvmfs_repo_name} ' 'read-only' without fuse-overlayfs."
829841
830- export EESSI_READONLY=" container:cvmfs2 ${cvmfs_repo_name} /cvmfs/${cvmfs_repo_name} "
831-
832- EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY} " )
833- export EESSI_FUSE_MOUNTS
842+ if cvmfs_config stat ${cvmfs_repo_name} ; then
843+ # if the system has the repo available just pass it through
844+ BIND_PATHS=" ${BIND_PATHS} ,/cvmfs/${cvmfs_repo_name} :/cvmfs/${cvmfs_repo_name} "
845+ else
846+ # otherwise use apptainer capabilities to make it available within the container
847+ export EESSI_READONLY=" container:cvmfs2 ${cvmfs_repo_name} /cvmfs/${cvmfs_repo_name} "
848+ EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY} " )
849+ export EESSI_FUSE_MOUNTS
850+ fi
834851 fi
835852 elif [[ ${cvmfs_repo_access} == " rw" ]] ; then
836853 # use repo-specific overlay directories
839856
840857 [[ ${VERBOSE} -eq 1 ]] && echo -e " TMP directory contents:\n$( ls -l ${EESSI_TMPDIR} ) "
841858
842- # set environment variables for fuse mounts in Singularity container
843- export EESSI_READONLY=" container:cvmfs2 ${cvmfs_repo_name} /cvmfs_ro/${cvmfs_repo_name} "
844-
845- EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY} " )
859+ # make the target CernVM-FS repository available under /cvmfs_ro
860+ if cvmfs_config stat ${cvmfs_repo_name} ; then
861+ # if the system has the repo available just pass it through
862+ BIND_PATHS=" ${BIND_PATHS} ,/cvmfs/${cvmfs_repo_name} :/cvmfs_ro/${cvmfs_repo_name} "
863+ else
864+ # otherwise use apptainer capabilities to make it available within the container
865+ export EESSI_READONLY=" container:cvmfs2 ${cvmfs_repo_name} /cvmfs_ro/${cvmfs_repo_name} "
866+ EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY} " )
867+ fi
846868
847869 if [[ " ${OVERLAY_TOOL} " == " fuse-overlayfs" ]]; then
848870 EESSI_WRITABLE_OVERLAY=" container:fuse-overlayfs"
0 commit comments