|
316 | 316 | # iterate over entries in REPOSITORIES and check if they are known |
317 | 317 | for cvmfs_repo in "${REPOSITORIES[@]}" |
318 | 318 | do |
319 | | - # split into name and access mode if ',access=' in $cvmfs_repo |
320 | | - if [[ ${cvmfs_repo} == *",access="* ]] ; then |
321 | | - cvmfs_repo_name=${cvmfs_repo/,access=*/} # remove access mode specification |
322 | | - else |
323 | | - cvmfs_repo_name="${cvmfs_repo}" |
324 | | - fi |
| 319 | + readarray -td, cvmfs_repo_args < <(printf '%s' "$cvmfs_repo") |
| 320 | + cvmfs_repo_name=${cvmfs_repo_args[0]} |
| 321 | + |
325 | 322 | if [[ ! -n "${eessi_cvmfs_repos[${cvmfs_repo_name}]}" && ! -n ${cfg_cvmfs_repos[${cvmfs_repo_name}]} ]]; then |
326 | 323 | fatal_error "The repository '${cvmfs_repo_name}' is not an EESSI CVMFS repository or it is not known how to mount it (could be due to a typo or missing configuration). Run '$0 -l' to obtain a list of available repositories." "${REPOSITORY_ERROR_EXITCODE}" |
327 | 324 | fi |
|
331 | 328 | declare -A listed_repos=() |
332 | 329 | for cvmfs_repo in "${REPOSITORIES[@]}" |
333 | 330 | do |
334 | | - cvmfs_repo_name=${cvmfs_repo/,access=*/} # remove access mode |
| 331 | + readarray -td, cvmfs_repo_args < <(printf '%s' "$cvmfs_repo") |
| 332 | + cvmfs_repo_name=${cvmfs_repo_args[0]} |
335 | 333 | [[ ${VERBOSE} -eq 1 ]] && echo "checking for duplicates: '${cvmfs_repo}' and '${cvmfs_repo_name}'" |
336 | 334 | # if cvmfs_repo_name is not in eessi_cvmfs_repos, assume it's in cfg_cvmfs_repos |
337 | 335 | # and obtain actual repo_name from config |
@@ -617,14 +615,8 @@ mkdir -p ${EESSI_TMPDIR}/repos_cfg |
617 | 615 | for cvmfs_repo in "${REPOSITORIES[@]}" |
618 | 616 | do |
619 | 617 | [[ ${VERBOSE} -eq 1 ]] && echo "process CVMFS repo spec '${cvmfs_repo}'" |
620 | | - # split into name and access mode if ',access=' in $cvmfs_repo |
621 | | - if [[ ${cvmfs_repo} == *",access="* ]] ; then |
622 | | - cvmfs_repo_name=${cvmfs_repo/,access=*/} # remove access mode specification |
623 | | - cvmfs_repo_access=${cvmfs_repo/*,access=/} # remove repo name part |
624 | | - else |
625 | | - cvmfs_repo_name="${cvmfs_repo}" |
626 | | - cvmfs_repo_access="${ACCESS}" # use globally defined access mode |
627 | | - fi |
| 618 | + readarray -td, cvmfs_repo_args < <(printf '%s' "$cvmfs_repo") |
| 619 | + cvmfs_repo_name=${cvmfs_repo_args[0]} |
628 | 620 | # if cvmfs_repo_name is in cfg_cvmfs_repos, it is a "repository ID" and was |
629 | 621 | # derived from information in EESSI_REPOS_CFG_FILE, namely the section |
630 | 622 | # names in that .ini-type file |
|
761 | 753 | unset cfg_repo_id |
762 | 754 | [[ ${VERBOSE} -eq 1 ]] && echo "add fusemount options for CVMFS repo '${cvmfs_repo}'" |
763 | 755 | # split into name, access mode, and mount mode |
764 | | - readarray -td, cvmfs_repo_args <<<"$cvmfs_repo" |
765 | | - cvmfs_repo_name=$(sed -e 's/\\n//g' <<< "${cvmfs_repo_args[0]}") |
| 756 | + readarray -td, cvmfs_repo_args < <(printf '%s' "$cvmfs_repo") |
| 757 | + cvmfs_repo_name=${cvmfs_repo_args[0]} |
766 | 758 | cvmfs_repo_access="${ACCESS}" # initialize to the default access mode |
| 759 | + cvmfs_repo_mount="fuse" # use fuse mounts by default |
767 | 760 | for arg in ${cvmfs_repo_args[@]:1}; do |
768 | 761 | if [[ $arg == "access="* ]]; then |
769 | 762 | cvmfs_repo_access=${arg/access=} |
770 | 763 | fi |
771 | 764 | if [[ $arg == "mount="* ]]; then |
772 | 765 | 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 |
778 | 766 | fi |
779 | 767 | done |
780 | 768 |
|
| 769 | + # check if the specified mount mode is a valid one |
| 770 | + if [[ ${cvmfs_repo_mount} != "bind" ]] && [[ ${cvmfs_repo_mount} != "fuse" ]]; then |
| 771 | + echo -e "ERROR: mount mode '${cvmfs_repo_mount}' for CVMFS repository\n '${cvmfs_repo_name}' is not known" |
| 772 | + exit ${REPOSITORY_ERROR_EXITCODE} |
| 773 | + fi |
| 774 | + [[ ${VERBOSE} -eq 1 ]] && echo "Using a ${cvmfs_repo_mount} mount for /cvmfs/${cvmfs_repo_name}" |
| 775 | + |
781 | 776 | # obtain cvmfs_repo_name from EESSI_REPOS_CFG_FILE if cvmfs_repo is in cfg_cvmfs_repos |
782 | 777 | if [[ ${cfg_cvmfs_repos[${cvmfs_repo_name}]} ]]; then |
783 | 778 | [[ ${VERBOSE} -eq 1 ]] && echo "repo '${cvmfs_repo_name}' is not an EESSI CVMFS repository..." |
784 | 779 | # cvmfs_repo_name is actually a repository ID, use that to obtain |
785 | 780 | # the actual name from the EESSI_REPOS_CFG_FILE |
786 | 781 | cfg_repo_id=${cvmfs_repo_name} |
787 | | - echo "bob $cfg_repo_id" |
788 | 782 | cvmfs_repo_name=$(cfg_get_value ${cfg_repo_id} "repo_name") |
789 | | - echo $cvmfs_repo_name |
790 | 783 | fi |
791 | 784 | # remove project subdir in container |
792 | 785 | cvmfs_repo_name=${cvmfs_repo_name%"/${EESSI_DEV_PROJECT}"} |
793 | 786 |
|
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}" |
803 | 787 | # if a bind mount was requested, check if the repository is really available on the host |
804 | 788 | if [[ ${cvmfs_repo_mount} == "bind" ]]; then |
805 | 789 | if [[ ! -x $(command -v cvmfs_config) ]] || ! cvmfs_config probe ${cvmfs_repo_name} >& /dev/null; then |
|
0 commit comments