Skip to content

Commit 51d3d91

Browse files
committed
use fuse mounts by default, make sure trailing newlines are removed from variables
1 parent f53567b commit 51d3d91

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

eessi_container.sh

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -762,22 +762,29 @@ do
762762
[[ ${VERBOSE} -eq 1 ]] && echo "add fusemount options for CVMFS repo '${cvmfs_repo}'"
763763
# split into name, access mode, and mount mode
764764
readarray -td, cvmfs_repo_args <<<"$cvmfs_repo"
765-
cvmfs_repo_name=$(sed -e 's/\\n//g' <<< "${cvmfs_repo_args[0]}")
765+
cvmfs_repo_name=${cvmfs_repo_args[0]%$'\n'} # remove possible trailing newline
766766
cvmfs_repo_access="${ACCESS}" # initialize to the default access mode
767+
cvmfs_repo_mount="fuse" # use fuse mounts by default
767768
for arg in ${cvmfs_repo_args[@]:1}; do
768769
if [[ $arg == "access="* ]]; then
769770
cvmfs_repo_access=${arg/access=}
771+
# remove possible trailing newline
772+
cvmfs_repo_access=${cvmfs_repo_access%$'\n'}
770773
fi
771774
if [[ $arg == "mount="* ]]; then
772775
cvmfs_repo_mount=${arg/mount=}
773-
# check if the specified mount mode is a valid one
774-
if [[ ${cvmfs_repo_mount} != "bind" ]] && [[ ${cvmfs_repo_mount} != "fuse" ]]; then
775-
echo -e "ERROR: mount mode '${cvmfs_repo_mount}' for CVMFS repository\n '${cvmfs_repo_name}' is not known"
776-
exit ${REPOSITORY_ERROR_EXITCODE}
777-
fi
776+
# remove possible trailing newline
777+
cvmfs_repo_mount=${cvmfs_repo_mount%$'\n'}
778778
fi
779779
done
780780

781+
# check if the specified mount mode is a valid one
782+
if [[ ${cvmfs_repo_mount} != "bind" ]] && [[ ${cvmfs_repo_mount} != "fuse" ]]; then
783+
echo -e "ERROR: mount mode '${cvmfs_repo_mount}' for CVMFS repository\n '${cvmfs_repo_name}' is not known"
784+
exit ${REPOSITORY_ERROR_EXITCODE}
785+
fi
786+
[[ ${VERBOSE} -eq 1 ]] && echo "Using a ${cvmfs_repo_mount} mount for /cvmfs/${cvmfs_repo_name}"
787+
781788
# obtain cvmfs_repo_name from EESSI_REPOS_CFG_FILE if cvmfs_repo is in cfg_cvmfs_repos
782789
if [[ ${cfg_cvmfs_repos[${cvmfs_repo_name}]} ]]; then
783790
[[ ${VERBOSE} -eq 1 ]] && echo "repo '${cvmfs_repo_name}' is not an EESSI CVMFS repository..."
@@ -791,15 +798,6 @@ do
791798
# remove project subdir in container
792799
cvmfs_repo_name=${cvmfs_repo_name%"/${EESSI_DEV_PROJECT}"}
793800

794-
# if a mount mode was not specified, we use a bind mount if the repository is available on the host,
795-
# and otherwise we use a fuse mount
796-
if [[ -z ${cvmfs_repo_mount} ]]; then
797-
cvmfs_repo_mount="fuse"
798-
if [[ -x $(command -v cvmfs_config) ]] && cvmfs_config probe ${cvmfs_repo_name} >& /dev/null; then
799-
cvmfs_repo_mount="bind"
800-
fi
801-
fi
802-
[[ ${VERBOSE} -eq 1 ]] && echo "Using a ${cvmfs_repo_mount} mount for /cvmfs/${cvmfs_repo_name}"
803801
# if a bind mount was requested, check if the repository is really available on the host
804802
if [[ ${cvmfs_repo_mount} == "bind" ]]; then
805803
if [[ ! -x $(command -v cvmfs_config) ]] || ! cvmfs_config probe ${cvmfs_repo_name} >& /dev/null; then

0 commit comments

Comments
 (0)