script/Bootstrap/Pmodules/bash:
- expose less env.vars to the user, cache them in PMODULES_ENV
This commit is contained in:
@@ -118,18 +118,38 @@ function replace_path () {
|
||||
sed '/^\s*$/d' | tr "\n" ":" | sed -e 's|^:||' -e 's|:$||')
|
||||
}
|
||||
|
||||
module purge
|
||||
save_env() {
|
||||
local s=''
|
||||
while (( $# > 0 )); do
|
||||
s+="$( typeset -p $1 );"
|
||||
shift
|
||||
done
|
||||
echo export PMODULES_ENV=$( base64 <<< "$s" )
|
||||
}
|
||||
|
||||
#module purge
|
||||
|
||||
#############################################################################
|
||||
# setup environment
|
||||
#
|
||||
declare -x LOADEDMODULES=''
|
||||
declare -x _LMFILES_=''
|
||||
declare -x PSI_LOADEDFAMILIES=''
|
||||
declare -x MODULEPATH=''
|
||||
for f in ${PSI_DEFAULT_FAMILIES}; do
|
||||
for f in ${PSI_DEFAULT_FAMILIES//:/ }; do
|
||||
append_path MODULEPATH "${PSI_PREFIX}/${PSI_MODULES_ROOT}/$f"
|
||||
append_path PSI_LOADEDFAMILIES "${f}"
|
||||
done
|
||||
declare -x USED_RELEASES=''
|
||||
for r in ${PSI_DEFAULT_RELEASES//:/ }; do
|
||||
append_path USED_RELEASES "${r}"
|
||||
done
|
||||
|
||||
eval $(save_env USED_RELEASES PSI_DEFAULT_RELEASES PSI_DEFAULT_FAMILIES PSI_DEFINED_RELEASES)
|
||||
unset USED_RELEASES
|
||||
unset PSI_DEFAULT_RELEASES
|
||||
unset PSI_DEFAULT_FAMILIES
|
||||
unset PSI_DEFINED_RELEASES
|
||||
|
||||
replace_path PATH "${PMODULES_HOME%/*}/.*"
|
||||
replace_path MANPATH "${PMODULES_HOME%/*}/.*"
|
||||
|
||||
Reference in New Issue
Block a user