mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-25 00:57:58 +02:00
Merge branch '134-fix-bugs-in-modmanage' into 'master'
Resolve "fix bugs in modmanage" Closes #134 See merge request Pmodules/src!103
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare PMODULES_MODULEFILES_DIR='modulefiles'
|
||||
declare PMODULES_CONFIG_DIR='config'
|
||||
declare -A GroupDepths=()
|
||||
declare -A Subcommands=()
|
||||
declare -A Options=()
|
||||
|
||||
+46
-2
@@ -144,13 +144,38 @@ std::replace_path () {
|
||||
}
|
||||
|
||||
#
|
||||
# split an absolute path
|
||||
# Functions to split a path into its components.
|
||||
#
|
||||
# Args:
|
||||
# $1 upvar
|
||||
# $2 absolute path
|
||||
# $2 absolute or relative path (depends on the function)
|
||||
# $3 opt upvar: number of components
|
||||
#
|
||||
# Notes:
|
||||
# std::split_path()
|
||||
# if the path is absolute, the first element of the returned array is empty.
|
||||
#
|
||||
# std::split_abspath()
|
||||
# the path must begin with a slash, otherwise std::die() is called with
|
||||
# an internal error message.
|
||||
#
|
||||
# std::split_relpath()
|
||||
# analog to std::split_abspath() with a relative path.
|
||||
#
|
||||
std::split_path() {
|
||||
local parts="$1"
|
||||
local -r path="$2"
|
||||
|
||||
IFS='/'
|
||||
local std__split_path_result=( ${std__split_path_tmp} )
|
||||
unset IFS
|
||||
std::upvar ${parts} "${std__split_path_result[@]}"
|
||||
if (( $# >= 3 )); then
|
||||
# return number of parts
|
||||
std::upvar "$3" ${#std__split_path_result[@]}
|
||||
fi
|
||||
}
|
||||
|
||||
std::split_abspath() {
|
||||
local parts="$1"
|
||||
local -r path="$2"
|
||||
@@ -170,6 +195,25 @@ std::split_abspath() {
|
||||
fi
|
||||
}
|
||||
|
||||
std::split_relpath() {
|
||||
local parts="$1"
|
||||
local -r path="$2"
|
||||
if [[ "${path:0:1}" == '/' ]]; then
|
||||
std::die 255 "Oops: Internal error in '${FUNCNAME[0]}' called by '${FUNCNAME[1]}' }"
|
||||
else
|
||||
local -r std__split_path_tmp="${path}"
|
||||
fi
|
||||
|
||||
IFS='/'
|
||||
local std__split_path_result=( ${std__split_path_tmp} )
|
||||
unset IFS
|
||||
std::upvar ${parts} "${std__split_path_result[@]}"
|
||||
if (( $# >= 3 )); then
|
||||
# return number of parts
|
||||
std::upvar "$3" ${#std__split_path_result[@]}
|
||||
fi
|
||||
}
|
||||
|
||||
std::read_versions() {
|
||||
local -r fname="$1"
|
||||
local varname=''
|
||||
|
||||
+382
-612
File diff suppressed because it is too large
Load Diff
@@ -2,4 +2,10 @@
|
||||
|
||||
unset BASH_ENV
|
||||
|
||||
"@BASH@" --noprofile --norc "@MODMANAGE@ "$@"
|
||||
declare mydir=$(cd $(dirname "$0") && pwd)
|
||||
declare libexecdir="$(dirname "${mydir}")/libexec"
|
||||
|
||||
declare bash="${libexecdir}/bash"
|
||||
declare modmanage="${libexecdir}/modmanage.bash"
|
||||
|
||||
"${bash}" --noprofile --norc "${modmanage}" "$@"
|
||||
|
||||
@@ -489,6 +489,9 @@ pmodules::install() {
|
||||
sed "${sed_cmd}" "${SRC_DIR}/modulecmd.tcl.in" > "${PMODULES_HOME}/libexec/modulecmd.tcl"
|
||||
chmod 0755 "${PMODULES_HOME}/libexec/modulecmd.tcl"
|
||||
|
||||
sed "${sed_cmd}" "${SRC_DIR}/libpmodules.bash.in" > "${PMODULES_HOME}/lib/libpmodules.bash"
|
||||
chmod 0755 "${PMODULES_HOME}/lib/libpmodules.bash"
|
||||
|
||||
sed "${sed_cmd}" "${SRC_DIR}/modbuild.in" > "${PMODULES_HOME}/bin/modbuild"
|
||||
chmod 0755 "${PMODULES_HOME}/bin/modbuild"
|
||||
|
||||
@@ -505,7 +508,6 @@ pmodules::install() {
|
||||
install -m 0644 "${SRC_DIR}/csh" "${PMODULES_HOME}/init"
|
||||
install -m 0644 "${SRC_DIR}/zsh" "${PMODULES_HOME}/init"
|
||||
|
||||
install -m 0644 "${SRC_DIR}/libpmodules.bash" "${PMODULES_HOME}/lib"
|
||||
install -m 0644 "${SRC_DIR}/libpbuild.bash" "${PMODULES_HOME}/lib"
|
||||
install -m 0644 "${SRC_DIR}/libpbuild_dyn.bash" "${PMODULES_HOME}/lib"
|
||||
install -m 0644 "${SRC_DIR}/libstd.bash" "${PMODULES_HOME}/lib"
|
||||
|
||||
Reference in New Issue
Block a user