@@ -747,7 +747,14 @@ declare -a EESSI_FUSE_MOUNTS=()
747
747
# mount cvmfs-config repo (to get access to EESSI repositories such as software.eessi.io) unless env var
748
748
# EESSI_DO_NOT_MOUNT_CVMFS_CONFIG_CERN_CH is defined
749
749
if [ -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
751
758
fi
752
759
753
760
795
802
echo " session. Will use it as left-most directory in 'lowerdir' argument for fuse-overlayfs."
796
803
797
804
# 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
801
813
802
814
# now, put the overlay-upper read-only on top of the repo and make it available under the usual prefix /cvmfs
803
815
if [[ " ${OVERLAY_TOOL} " == " fuse-overlayfs" ]]; then
827
839
# basic "ro" access that doesn't require any fuseoverlay-fs
828
840
echo " Mounting '${cvmfs_repo_name} ' 'read-only' without fuse-overlayfs."
829
841
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
834
851
fi
835
852
elif [[ ${cvmfs_repo_access} == " rw" ]] ; then
836
853
# use repo-specific overlay directories
839
856
840
857
[[ ${VERBOSE} -eq 1 ]] && echo -e " TMP directory contents:\n$( ls -l ${EESSI_TMPDIR} ) "
841
858
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
846
868
847
869
if [[ " ${OVERLAY_TOOL} " == " fuse-overlayfs" ]]; then
848
870
EESSI_WRITABLE_OVERLAY=" container:fuse-overlayfs"
0 commit comments