@@ -47,6 +47,7 @@ HTTP_PROXY_ERROR_EXITCODE=$((${ANY_ERROR_EXITCODE} << 9))
4747HTTPS_PROXY_ERROR_EXITCODE=$(( ${ANY_ERROR_EXITCODE} << 10 ))
4848RUN_SCRIPT_MISSING_EXITCODE=$(( ${ANY_ERROR_EXITCODE} << 11 ))
4949NVIDIA_MODE_UNKNOWN_EXITCODE=$(( ${ANY_ERROR_EXITCODE} << 12 ))
50+ OVERLAY_TOOL_EXITCODE=$(( ${ANY_ERROR_EXITCODE} << 13 ))
5051
5152# CernVM-FS settings
5253CVMFS_VAR_LIB=" var-lib-cvmfs"
@@ -89,6 +90,9 @@ display_help() {
8990 echo " -n | --nvidia MODE - configure the container to work with NVIDIA GPUs,"
9091 echo " MODE==install for a CUDA installation, MODE==run to"
9192 echo " attach a GPU, MODE==all for both [default: false]"
93+ echo " -o | --overlay-tool ARG - tool to use to create (read-only or writable) overlay;"
94+ echo " selected tool *must* be available in container image being used;"
95+ echo " can be 'fuse-overlayfs' or 'unionfs' [default: fuse-overlayfs]"
9296 echo " -p | --pass-through ARG - argument to pass through to the launch of the"
9397 echo " container; can be given multiple times [default: not set]"
9498 echo " -r | --repository CFG - configuration file or identifier defining the"
@@ -128,6 +132,7 @@ VERBOSE=0
128132STORAGE=
129133LIST_REPOS=0
130134MODE=" shell"
135+ OVERLAY_TOOL=" fuse-overlayfs"
131136PASS_THROUGH=()
132137SETUP_NVIDIA=0
133138REPOSITORIES=()
@@ -185,6 +190,10 @@ while [[ $# -gt 0 ]]; do
185190 NVIDIA_MODE=" $2 "
186191 shift 2
187192 ;;
193+ -o|--overlay-tool)
194+ OVERLAY_TOOL=" $2 "
195+ shift 2
196+ ;;
188197 -p|--pass-through)
189198 PASS_THROUGH+=(" $2 " )
190199 shift 2
779788 # below); the overlay-upper directory can only exist because it is part of
780789 # the ${RESUME} directory or tarball
781790 # to be able to see the contents of the read-write session we have to mount
782- # the fuse-overlayfs (in read-only mode) on top of the CernVM-FS repository
791+ # the overlay (in read-only mode) on top of the CernVM-FS repository
783792
784793 echo " While processing '${cvmfs_repo_name} ' to be mounted 'read-only' we detected an overlay-upper"
785794 echo " directory (${EESSI_TMPDIR} /${cvmfs_repo_name} /overlay-upper) likely from a previous"
791800 EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY} " )
792801
793802 # now, put the overlay-upper read-only on top of the repo and make it available under the usual prefix /cvmfs
794- EESSI_READONLY_OVERLAY=" container:fuse-overlayfs"
795- # The contents of the previous session are available under
796- # ${EESSI_TMPDIR} which is bind mounted to ${TMP_IN_CONTAINER}.
797- # Hence, we have to use ${TMP_IN_CONTAINER}/${cvmfs_repo_name}/overlay-upper
798- # the left-most directory given for the lowerdir argument is put on top,
799- # and with no upperdir=... the whole overlayfs is made available read-only
800- EESSI_READONLY_OVERLAY+=" -o lowerdir=${TMP_IN_CONTAINER} /${cvmfs_repo_name} /overlay-upper:/cvmfs_ro/${cvmfs_repo_name} "
801- EESSI_READONLY_OVERLAY+=" /cvmfs/${cvmfs_repo_name} "
803+ if [[ " ${OVERLAY_TOOL} " == " fuse-overlayfs" ]]; then
804+ EESSI_READONLY_OVERLAY=" container:fuse-overlayfs"
805+ # The contents of the previous session are available under
806+ # ${EESSI_TMPDIR} which is bind mounted to ${TMP_IN_CONTAINER}.
807+ # Hence, we have to use ${TMP_IN_CONTAINER}/${cvmfs_repo_name}/overlay-upper
808+ # the left-most directory given for the lowerdir argument is put on top,
809+ # and with no upperdir=... the whole overlayfs is made available read-only
810+ EESSI_READONLY_OVERLAY+=" -o lowerdir=${TMP_IN_CONTAINER} /${cvmfs_repo_name} /overlay-upper:/cvmfs_ro/${cvmfs_repo_name} "
811+ EESSI_READONLY_OVERLAY+=" /cvmfs/${cvmfs_repo_name} "
812+ elif [[ " ${OVERLAY_TOOL} " == " unionfs" ]]; then
813+ EESSI_READONLY_OVERLAY=" container:unionfs"
814+ # cow stands for 'copy-on-write'
815+ EESSI_READONLY_OVERLAY+=" -o cow"
816+ EESSI_READONLY_OVERLAY+=" /cvmfs_ro/software.eessi.io=RO"
817+ EESSI_READONLY_OVERLAY+=" /cvmfs/${cvmfs_repo_name} "
818+ else
819+ echo -e " ERROR: unknown overlay tool specified: ${OVERLAY_TOOL} "
820+ exit ${OVERLAY_TOOL_EXITCODE}
821+ fi
802822 export EESSI_READONLY_OVERLAY
803823
804824 EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY_OVERLAY} " )
824844
825845 EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_READONLY} " )
826846
827- EESSI_WRITABLE_OVERLAY=" container:fuse-overlayfs"
828- EESSI_WRITABLE_OVERLAY+=" -o lowerdir=/cvmfs_ro/${cvmfs_repo_name} "
829- EESSI_WRITABLE_OVERLAY+=" -o upperdir=${TMP_IN_CONTAINER} /${cvmfs_repo_name} /overlay-upper"
830- EESSI_WRITABLE_OVERLAY+=" -o workdir=${TMP_IN_CONTAINER} /${cvmfs_repo_name} /overlay-work"
831- EESSI_WRITABLE_OVERLAY+=" /cvmfs/${cvmfs_repo_name} "
847+ if [[ " ${OVERLAY_TOOL} " == " fuse-overlayfs" ]]; then
848+ EESSI_WRITABLE_OVERLAY=" container:fuse-overlayfs"
849+ EESSI_WRITABLE_OVERLAY+=" -o lowerdir=/cvmfs_ro/${cvmfs_repo_name} "
850+ EESSI_WRITABLE_OVERLAY+=" -o upperdir=${TMP_IN_CONTAINER} /${cvmfs_repo_name} /overlay-upper"
851+ EESSI_WRITABLE_OVERLAY+=" -o workdir=${TMP_IN_CONTAINER} /${cvmfs_repo_name} /overlay-work"
852+ EESSI_WRITABLE_OVERLAY+=" /cvmfs/${cvmfs_repo_name} "
853+ elif [[ " ${OVERLAY_TOOL} " == " unionfs" ]]; then
854+ # files touched are reflected under /cvmfs/<repo>/.unionfs/
855+ EESSI_WRITABLE_OVERLAY=" container:unionfs"
856+ # cow stands for 'copy-on-write'
857+ EESSI_WRITABLE_OVERLAY+=" -o cow"
858+ EESSI_WRITABLE_OVERLAY+=" ${TMP_IN_CONTAINER} /${cvmfs_repo_name} /overlay-upper=RW:/cvmfs_ro/software.eessi.io=RO"
859+ EESSI_WRITABLE_OVERLAY+=" /cvmfs/${cvmfs_repo_name} "
860+ else
861+ echo -e " ERROR: unknown overlay tool specified: ${OVERLAY_TOOL} "
862+ exit ${OVERLAY_TOOL_EXITCODE}
863+ fi
832864 export EESSI_WRITABLE_OVERLAY
833865
834866 EESSI_FUSE_MOUNTS+=(" --fusemount" " ${EESSI_WRITABLE_OVERLAY} " )
0 commit comments