From e7127caf4e7cddc46d11cfebd206a74249158048 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 2 Mar 2015 13:31:06 +0100 Subject: [PATCH] environment.bash, profile.bash: fixes, more verbose error messages --- scripts/Bootstrap/environment.bash | 17 ++--------------- scripts/Bootstrap/profile.bash | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/scripts/Bootstrap/environment.bash b/scripts/Bootstrap/environment.bash index f3662cd..be8bfca 100644 --- a/scripts/Bootstrap/environment.bash +++ b/scripts/Bootstrap/environment.bash @@ -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' diff --git a/scripts/Bootstrap/profile.bash b/scripts/Bootstrap/profile.bash index 2949471..67db682 100644 --- a/scripts/Bootstrap/profile.bash +++ b/scripts/Bootstrap/profile.bash @@ -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