Files
Pmodules/Pmodules/libpmodules.bash.in
T
gsell d1a66d5e6f libpmodules.bash reviewed
- cleanup code in lib
- function we need in modmanage moved to lib
- some cleanup in modulecmd
2021-11-08 14:05:05 +01:00

41 lines
964 B
Bash

#!/bin/bash
if [[ -z ${sbindir} ]]; then
local sbindir=$(dirname "${BASH_SOURCE}")
sbindir=$(cd "${sbindir}"/.. && pwd)"/sbin"
fi
pmodules::get_options() {
local "$1"
std::upvar $1 $("${sbindir}/getopt" "${@:2}")
}
pmodules::check_env_vars() {
[[ -n "${PMODULES_ROOT}" ]] &&
[[ -n "${PMODULES_HOME}" ]] &&
[[ -n "${PMODULES_VERSION}" ]] || std::die 1 "
Error: the module environment you are going to use as source has not been
initialized properly!"
}
pmodules::check_directories() {
local -r src_prefix="$1"
[[ -d "${src_prefix}" ]] &&
[[ -d "${src_prefix}/${PMODULES_CONFIG_DIR}" ]] &&
[[ -d "${src_prefix}/Tools/Pmodules/${PMODULES_VERSION}" ]] || std::die 1 "
Error: the module environment '${src_prefix}' has not been initialized properly!"
}
pmodules::check_env() {
pmodules::check_env_vars
pmodules::check_directories "${PMODULES_ROOT}"
}
# Local Variables:
# mode: sh
# sh-basic-offset: 8
# tab-width: 8
# End: