diff --git a/setup.sh b/setup.sh index edc65d6b3..01b85b7b3 100755 --- a/setup.sh +++ b/setup.sh @@ -20,7 +20,6 @@ echo "Setting environment variable SPACK_STACK_DIR to ${SPACK_STACK_DIR}" source ${SPACK_STACK_DIR:?}/spack/share/spack/setup-env.sh echo "Sourcing spack environment ${SPACK_STACK_DIR}/spack/share/spack/setup-env.sh" -# Register spack-stack Spack extensions libpath=${SPACK_STACK_DIR}/lib/jcsda-emc/spack-stack if [ -d ${libpath}/stack/cmd ]; then spack config --scope defaults add "config:extensions:$libpath" @@ -30,14 +29,18 @@ else fi # Register the jcsda-emc repos -msg="Error: Repository is already registered with Spack" +msg1="Added repo with namespace" +msg2="Repository is already registered with Spack" for repo in jcsda-emc jcsda-emc-bundles; do - othererrors=$(spack repo add ${SPACK_STACK_DIR}/repos/$repo --scope defaults |& grep -v "$msg" | wc -l) - if [ $othererrors -ne 0 ]; then + othererrors=$(spack repo add ${SPACK_STACK_DIR}/repos/$repo --scope defaults |& grep -v -e "$msg1" -e "$msg2") + if [ $(echo "$othererrors" | grep -c .) -ne 0 ]; then + echo "$othererrors" return 2 fi if [ ! -d ${SPACK_STACK_DIR}/repos/$repo ]; then - echo "WARNING: Repo directory ${SPACK_STACK_DIR}/repos/$repo does not exist!" + echo "FATAL ERROR: Repo directory ${SPACK_STACK_DIR}/repos/$repo does not exist!" return 3 fi done + +echo "spack-stack extensions and repos are registered"