environment.bash, profile.bash: fixes, more verbose error messages

This commit is contained in:
2015-03-02 13:31:06 +01:00
parent 7e2b76dfe5
commit e7127caf4e
2 changed files with 20 additions and 17 deletions

View File

@@ -1,28 +1,15 @@
#!/bin/bash
declare -x PSI_PREFIX=$(cd $(dirname "${BASH_SOURCE}")/.. && pwd)
declare -x PSI_CONFIG_DIR=$(basename $(cd $(dirname "${BASH_SOURCE}") && pwd))
if [[ -z ${PMODULES_VERSION} ]]; then
declare -x PMODULES_VERSION="0.99.1"
fi
declare -x PMODULES_HOME="${PSI_PREFIX}/Tools/Pmodules/${PMODULES_VERSION}"
declare -A PSI_FAMILIES=(
['Legacy']=0
['Libraries']=0
['Programming']=0
['Numeric']=0
['System']=0
['Tools']=0
['Compiler']=2
['MPI']=4
['HDF5_serial']=4
['HDF5']=6
)
declare -x PSI_CONFIG_DIR=$(basename $(cd $(dirname "${BASH_SOURCE}") && pwd))
declare -x PSI_MODULES_ROOT='modulefiles'
declare -x PSI_TEMPLATES_DIR='templates'
declare -x PSI_DEFAULT_FAMILIES='Tools Programming'

View File

@@ -15,8 +15,24 @@ unset _init_env_file
############################################################################
# check configuration
#
if [[ ! -d ${PSI_PREFIX} ]] || [[ ! -d ${PMODULES_HOME} ]]; then
echo "Oops: cannot initialize module environment !"
if [[ -z ${PSI_PREFIX} ]]; then
echo "Oops: Pmodules prefix not set." 1>&2
return 1
fi
if [[ ! -d ${PSI_PREFIX} ]]; then
echo "Oops: ${PSI_PREFIX}: Set as Pmodules prefix, but this is not a directory." 1>&2
return 1
fi
if [[ -z ${PMODULES_VERSION} ]]; then
echo "Oops: ${PMODULES_VERSION}: Pmodules version not set." 1>&2
return 1
fi
if [[ -z ${PMODULES_HOME} ]]; then
echo "Oops: ${PMODULES_HOME}: Pmodules home not set." 1>&2
return 1
fi
if [[ ! -d ${PMODULES_HOME} ]]; then
echo "Oops: ${PMODULES_HOME}: Set as Pmodules home, but this is not a directory." 1>&2
return 1
fi