mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-23 08:17:56 +02:00
54 lines
1.3 KiB
Bash
54 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
#############################################################################
|
|
# bash 3 or newer ...
|
|
#
|
|
if [ ${BASH_VERSINFO:-0} -lt 3 ]; then
|
|
echo "BASH version ${BASH_VERSION} ist not supported! You need at least version 3..."
|
|
return 1
|
|
fi
|
|
|
|
############################################################################
|
|
# some sanity checks
|
|
#
|
|
if [[ ! -d ${PMODULES_HOME} ]]; then
|
|
echo "Oops: ${PMODULES_HOME}: Set as Pmodules home, but this is not a directory." 1>&2
|
|
return 1
|
|
fi
|
|
|
|
#############################################################################
|
|
# initialize bash completion
|
|
#
|
|
if [[ -r "${PMODULES_HOME}/init/bash_completion" ]]; then
|
|
source "${PMODULES_HOME}/init/bash_completion"
|
|
fi
|
|
|
|
#############################################################################
|
|
# legacy...
|
|
#
|
|
unset MODULE_VERSION
|
|
unset MODULE_VERSION_STACK
|
|
unset MODULESHOME
|
|
|
|
declare -x PMODULES_DIR="${PMODULES_HOME}"
|
|
|
|
#############################################################################
|
|
# implement module comand as shell function
|
|
#
|
|
module() {
|
|
unset BASH_ENV
|
|
eval $("${PMODULES_HOME}/bin/modulecmd" bash "$@")
|
|
}
|
|
export -f module
|
|
|
|
modbuild(){
|
|
"${PMODULES_HOME}/bin/modbuild" "$@"
|
|
}
|
|
export -f modbuild
|
|
|
|
# Local Variables:
|
|
# mode: sh
|
|
# sh-basic-offset: 8
|
|
# tab-width: 8
|
|
# End:
|