diff --git a/Pmodules/libpmodules.bash.in b/Pmodules/libpmodules.bash.in index 0ee070f..5a2dfe8 100644 --- a/Pmodules/libpmodules.bash.in +++ b/Pmodules/libpmodules.bash.in @@ -75,17 +75,17 @@ get_ol_config_files(){ "$_" files+=("${PMODULES_OVERLAYS_DEF}") fi - if [[ -r "${HOME}/.Pmodules/overlays.yaml" ]]; then - files+=("${HOME}/.Pmodules/overlays.yaml") + if [[ -r "${HOME}/.Pmodules/Pmodules.yaml" ]]; then + files+=("${HOME}/.Pmodules/Pmodules.yaml") fi - test -r "${PMODULES_ROOT}/config/overlays.yaml" || \ + test -r "${PMODULES_ROOT}/config/Pmodules.yaml" || \ std::die 3 \ "%s %s -- %s" \ "base overlay definition file" \ "does not exist or is not readable" \ "$_" - files+=("${PMODULES_ROOT}/config/overlays.yaml") + files+=("${PMODULES_ROOT}/config/Pmodules.yaml") std::upvar "$1" "${files[@]}" } @@ -93,24 +93,24 @@ get_ol_config_files(){ get_ol_install_root(){ # $1 overlay name # ${@:2} files - yq -Ne e ".$1.install_root" - < <(cat "${@:2}") 2>/dev/null + yq -Ne e ".overlays.$1.install_root" - < <(cat "${@:2}") 2>/dev/null } get_ol_modulefiles_root(){ # $1 overlay name # ${@:2} files - yq -Ne e ".$1.modulefiles_root" - < <(cat "${@:2}") 2>/dev/null + yq -Ne e ".overlays.$1.modulefiles_root" - < <(cat "${@:2}") 2>/dev/null } get_ol_type(){ # $1 overlay name # ${@:2} files - yq -Ne e ".$1.type" - < <(cat "${@:2}") 2>/dev/null + yq -Ne e ".overlays.$1.type" - < <(cat "${@:2}") 2>/dev/null } get_ol_names(){ # ${@} files - yq -Ne e "keys" - < <(cat "$@") 2>/dev/null | cut -b3- + yq -Ne e ".overlays|keys" - < <(cat "$@") 2>/dev/null | cut -b3- } get_ol_info(){ diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 27dccf0..7cb9bd2 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -38,9 +38,9 @@ declare verbosity_lvl=${PMODULES_VERBOSITY:-'verbose'} declare Shell='' -declare -r pmodules_config_file="${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/Pmodules.conf" +declare -r pmodules_config_file="${PMODULES_ROOT}/${PMODULES_CONFIG_DIR}/Pmodules.yaml" -# the following settings are used if the Pmodules.conf doesn't exist +# the following settings are used if the config file doesn't exist # set groups which should be available after initialization declare -- DefaultGroups='Tools Programming' @@ -1385,7 +1385,7 @@ subcommand_use() { txt='()replacing groups)' ;; esac - std::info "\t${ol_name}: ${ol_dir} ${txt}" + std::info "\t${ol_name}: ${ol_install_dir} ${txt}" done std::info '' @@ -1421,7 +1421,7 @@ subcommand_use() { local ol_type='' local ol_dir='' local ol_prefix='' - get_overlay_info \ + get_ol_info \ "${ol_name_or_dir}" \ ol_name \ ol_type \ @@ -1520,7 +1520,7 @@ subcommand_use() { UsedFlags+=( "${arg/flag=}" ) return fi - if get_overlay_info "${arg}"; then + if get_ol_info "${arg}"; then use_overlay "${arg}" return 0 fi @@ -1617,7 +1617,7 @@ subcommand_unuse() { local ol_type='' local ol_dir='' - get_overlay_info \ + get_ol_info \ "${ol_name_or_dir}" \ ol_name \ ol_type \ @@ -1714,7 +1714,7 @@ subcommand_unuse() { done return fi - if get_overlay_info "${arg}"; then + if get_ol_info "${arg}"; then unuse_overlay "${arg}" return 0 fi @@ -1823,7 +1823,7 @@ reset_modulepath() { reset_used_groups() { UsedGroups='' local group - for group in ${DefaultGroups}; do + for group in ${DefaultGroups//:/ }; do std::append_path UsedGroups "${group}" done g_env_must_be_saved='yes' @@ -1863,9 +1863,11 @@ init_manpath() { pmodules_init() { if [[ -r "${pmodules_config_file}" ]]; then - source "${pmodules_config_file}" || \ - std::die 3 "Oops: cannot parse config file -- %s\n" \ - "${pmodules_config_file}" + eval $(yq -Ne e ".defaults" ${pmodules_config_file} | \ + awk '/DefaultGroups|ReleaseStages|DefaultReleaseStages/ { + printf "%s=%s\n",substr($1,1,length($1)-1), $2}') || \ + std::die 3 "Oops: cannot parse config file -- %s\n" \ + "${pmodules_config_file}" fi declare -gx LOADEDMODULES='' declare -gx _LMFILES_=''