From 8c0b2d45ea9dce9585b3935d0ae9bec18d4bd1c7 Mon Sep 17 00:00:00 2001
From: Eleni Mathioulaki <emathioulaki@athenarc.gr>
Date: Wed, 1 Mar 2023 18:02:19 +0100
Subject: [PATCH] minor changes to installation script

---
 install_spack_env.sh | 14 ++++++++------
 load_sim_tools.sh    | 24 ------------------------
 2 files changed, 8 insertions(+), 30 deletions(-)
 delete mode 100644 load_sim_tools.sh

diff --git a/install_spack_env.sh b/install_spack_env.sh
index 96c17f52..bd4680eb 100644
--- a/install_spack_env.sh
+++ b/install_spack_env.sh
@@ -7,16 +7,17 @@
 #                 (if the specified spack instance doesn't exist, it also creates it)
 # ===========================================================================================================
 
-INSTALLATION_ROOT=$1
-SPACK_VERSION=$2
-EBRAINS_REPO=$3
-EBRAINS_SPACK_ENV=$4
+INSTALLATION_ROOT=$1  # where to set up the installation
+SPACK_VERSION=$2      # which spack version to use
+EBRAINS_REPO=$3       # location of ebrains-spack-builds repository
+EBRAINS_SPACK_ENV=$4  # name of EBRAINS Spack environment to be created/updated
 
 # specify location of .spack dir (by default in ~)
+# this is where cache and configuration settings are stored
 export SPACK_USER_CACHE_PATH=$INSTALLATION_ROOT/spack/.spack
 export SPACK_USER_CONFIG_PATH=$INSTALLATION_ROOT/spack/.spack
 
-# initial setup: clone spack if spack dir doesn't already exist and activate
+# initial setup: clone spack if spack dir doesn't already exist
 if [ ! -d $INSTALLATION_ROOT/spack ]
 then
   git clone --depth 1 -c advice.detachedHead=false -c feature.manyFiles=true --branch $SPACK_VERSION https://github.com/spack/spack $INSTALLATION_ROOT/spack
@@ -24,6 +25,7 @@ fi
 # SPACK PATCH: see https://github.com/spack/spack/pull/35290
 sed -i 's/solver.solve(abstract_specs)/solver.solve(abstract_specs, tests=kwargs.get("tests", False))/g' $INSTALLATION_ROOT/spack/lib/spack/spack/concretize.py
 
+# copy package settings (modify if necessary) and activate Spack
 cp $EBRAINS_REPO/packages.yaml $INSTALLATION_ROOT/spack/etc/spack/packages.yaml
 source $INSTALLATION_ROOT/spack/share/spack/setup-env.sh
 
@@ -46,7 +48,7 @@ then
   spack env create $EBRAINS_SPACK_ENV
 fi
 
-# activate environment
+# update and activate environment
 cp $EBRAINS_REPO/spack.yaml $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/spack.yaml
 spack env activate $EBRAINS_SPACK_ENV
 # There is a known spack bug (https://github.com/spack/spack/issues/29447) in installing test dependencies
diff --git a/load_sim_tools.sh b/load_sim_tools.sh
deleted file mode 100644
index adb774a9..00000000
--- a/load_sim_tools.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-#title           :load_sim_tools.sh
-#description     :Script to load simulation software on the Collaboratory Lab containers from the Object Storage at CSCS.
-#author          :Athanasios Karmas
-#date            :20210601   
-#usage           :source ./load_sim_tools.sh
-#==============================================================================
-
-echo "Setting up environment..."
-
-INSTALLATION_ROOT="test-build"
-SPACKIFIED_ENV="ebrains-spack-builds"
-
-cp -r /srv/$INSTALLATION_ROOT/spack/.spack ~
-source /srv/$INSTALLATION_ROOT/spack/share/spack/setup-env.sh
-
-cd /srv/$INSTALLATION_ROOT
-spack repo add ebrains-spack-builds
-spack env activate $SPACKIFIED_ENV
-
-module use /srv/$INSTALLATION_ROOT/spack/share/spack/modules/linux-centos7-x86_64/
-source /srv/$INSTALLATION_ROOT/spack/var/spack/environments/$SPACKIFIED_ENV/loads
-
-echo "Everything ready!"
-- 
GitLab