From 20f01d1589320abea622c5dffce4284d3df12d2b Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 16 Dec 2021 18:55:59 +0100 Subject: [PATCH] libmodules.bash: get_overlay_info() moved to libpmodules.bash --- Pmodules/modulecmd.bash.in | 59 -------------------------------------- 1 file changed, 59 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index b9532c5..59088ca 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1297,65 +1297,6 @@ SWITCHES: searched releases. " -# helper function for subcommand_use() und subcommand_unuse() -get_overlay_info(){ - # Args: - # $1 [in] overlay name or directory plus optional type - # $2 [upvar] overlay type - # $3 [upvar] overlay root directory - # $4 [upvar] overlay prefix for software installation - # - local name_or_dir="${1%:*}" - [[ -d ${name_or_dir} ]] && name_or_dir=$(cd "${name_or_dir}" && pwd -L) - - local config_files=() - if [[ -v PMODULES_OVERLAYS_CONF ]]; then - config_files+=("${PMODULES_OVERLAYS_CONF}") - fi - config_files+=("${HOME}/.Pmodules/overlays.conf") - config_files+=("${PMODULES_ROOT}/config/overlays.conf") - - for config_file in "${config_files[@]}"; do - [[ -r "${config_file}" ]] || continue - local toks=() - local -i lino=0 - while read -a toks; do - (( lino++ )) - [[ -n "${toks[0]}" ]] || continue - [[ ${toks[0]} == \#* ]] && continue - (( ${#toks[@]} < 2 )) && \ - std::warn "%s - %s" \ - "Skipping malformed line ${lino} in configuration file" \ - "${config_file}" - local _name="${toks[0]%:*}" - if [[ "${toks[0]%:*}" == "${name_or_dir}" ]] \ - || [[ "${toks[1]}" == "${name_or_dir}" ]]; then - # take type from - # 1. $1 - # 2. configuration file - # 3. use default type - local _type="${ol_normal}" - if [[ "$1" == *:* ]]; then - _type="${1##*:}" - elif [[ "${toks[0]}" == *:* ]]; then - _type="${toks[0]##*:}" - fi - [[ -n "$2" ]] && std::upvar "$2" "${_type}" - [[ -n "$3" ]] && std::upvar "$3" "${toks[1]}" - if [[ -n "$4" ]]; then - if [[ -n "${toks[2]}" ]]; then - std::upvar "$4" "${toks[2]}" - else - std::upvar "$4" "${toks[1]}" - fi - fi - return 0 - fi - done < "${config_file}" - done - return 1 -} - subcommand_use() { local -r subcommand='use' IFS=':'