From f5bf857cee9155c13190d3f6465c57edf00e65de Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 17 May 2017 12:56:22 +0200 Subject: [PATCH] bootstrap: - add options to overwrite installation root and configuration file --- bootstrap.sh | 39 +++++++++++++++++++++++++++--- compile_pmodules.sh | 19 ++++++++++++++- config/environment.bash.opalrunner | 24 ++++++++++++++++++ 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 config/environment.bash.opalrunner diff --git a/bootstrap.sh b/bootstrap.sh index f7f3b27..84915a0 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,6 +1,39 @@ #!/bin/bash -declare -r BASE_DIR=$(cd "$(dirname $0)" && pwd) -${BASE_DIR}/compile_pmodules.sh || exit 1 -${BASE_DIR}/install_pmodules.sh || exit 1 +declare -a opts=() + +while (( $# > 0 )); do + case $1 in + --debug ) + opts+=( "$1" ) + ;; + --config ) + opts+=( "$1=$2" ) + shift 1 + ;; + --config=* ) + opts+=( "$1" ) + ;; + --install-root ) + opts+=( "$1=$2" ) + shift 1 + ;; + --install-root=* ) + opts+=( "$1" ) + ;; + -f | --force ) + opts+=( "$1" ) + ;; + -* ) + std::die 1 "$1: illegal option" + ;; + * ) + std::die 1 "No arguments are allowed." + ;; + esac + shift 1 +done + +${BASE_DIR}/compile_pmodules.sh "${opts[@]}" || exit 1 +${BASE_DIR}/install_pmodules.sh "${opts[@]}" || exit 1 diff --git a/compile_pmodules.sh b/compile_pmodules.sh index f2eaa80..937dbd6 100755 --- a/compile_pmodules.sh +++ b/compile_pmodules.sh @@ -2,12 +2,14 @@ declare -r BOOTSTRAP_DIR=$(dirname "$0") +unset PMODULES_ROOT unset PMODULES_HOME unset PMODULES_VERSION source "${BOOTSTRAP_DIR}/Pmodules/libstd.bash" declare force='no' +declare config_file="${BOOTSTRAP_DIR}/config/environment.bash" declare opts='--bootstrap' while (( $# > 0 )); do @@ -18,6 +20,20 @@ while (( $# > 0 )); do --debug ) opts+=" $1" ;; + --config ) + config_file="$2" + shift 1 + ;; + --config=* ) + config_file="${1#*=}" + ;; + --install-root ) + PMODULES_ROOT="$2" + shift 1 + ;; + --install-root=* ) + PMODULES_ROOT="${1#*=}" + ;; -f | --force ) force='yes' ;; @@ -32,7 +48,8 @@ while (( $# > 0 )); do done std::read_versions "${BOOTSTRAP_DIR}/config/versions.conf" -source "${BOOTSTRAP_DIR}/config/environment.bash" +source "${config_file}" + PMODULES_VERSION='' declare -x PMODULES_VERSION echo $PMODULES_VERSION diff --git a/config/environment.bash.opalrunner b/config/environment.bash.opalrunner new file mode 100644 index 0000000..1829aa5 --- /dev/null +++ b/config/environment.bash.opalrunner @@ -0,0 +1,24 @@ +#!/bin/bash +# + +# +# define PMODULES_ROOT only if it has not been passed as argument +# to build/install scripts +# +if [[ -z "${PMODULES_ROOT}" ]]; then + declare -x PMODULES_ROOT='/home/psi.local' +fi + +declare -x PMODULES_CONFIG_DIR='config' +declare -x PMODULES_MODULEFILES_DIR='modulefiles' +declare -x PMODULES_TEMPLATES_DIR='templates' + +declare -x PMODULES_HOME="${PMODULES_ROOT}/Tools/Pmodules/${PMODULES_VERSION}" + +declare -x PMODULES_DEFAULT_GROUPS='Tools Programming' +declare -x PMODULES_DEFINED_RELEASES=':unstable:stable:deprecated:' +declare -x PMODULES_DEFAULT_RELEASES='stable' + +declare -x PMODULES_DISTFILESDIR='/afs/psi.ch/software/Pmodules/distfiles' +declare -x PMODULES_TMPDIR="/var/tmp/${USER}" +