|
1 | 1 | #!/bin/bash
|
2 | 2 | #
|
3 | 3 | # Script to install EESSI pilot software stack (version 2021.12)
|
4 |
| -# |
| 4 | + |
| 5 | +# see example parsing of command line arguments at |
| 6 | +# https://wiki.bash-hackers.org/scripting/posparams#using_a_while_loop |
| 7 | +# https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash |
| 8 | + |
| 9 | +display_help() { |
| 10 | + echo "usage: $0 [OPTIONS]" |
| 11 | + echo " -g | --generic - instructs script to build for generic architecture target" |
| 12 | + echo " -h | --help - display this usage information" |
| 13 | + echo " -x | --http-proxy URL - provides URL for the environment variable http_proxy" |
| 14 | + echo " -y | --https-proxy URL - provides URL for the environment variable https_proxy" |
| 15 | +} |
| 16 | + |
| 17 | +POSITIONAL_ARGS=() |
| 18 | + |
| 19 | +while [[ $# -gt 0 ]]; do |
| 20 | + case $1 in |
| 21 | + -g|--generic) |
| 22 | + EASYBUILD_OPTARCH="GENERIC" |
| 23 | + shift |
| 24 | + ;; |
| 25 | + -h|--help) |
| 26 | + display_help # Call your function |
| 27 | + # no shifting needed here, we're done. |
| 28 | + exit 0 |
| 29 | + ;; |
| 30 | + -x|--http-proxy) |
| 31 | + export http_proxy="$2" |
| 32 | + shift 2 |
| 33 | + ;; |
| 34 | + -y|--https-proxy) |
| 35 | + export https_proxy="$2" |
| 36 | + shift 2 |
| 37 | + ;; |
| 38 | + -*|--*) |
| 39 | + echo "Error: Unknown option: $1" >&2 |
| 40 | + exit 1 |
| 41 | + ;; |
| 42 | + *) # No more options |
| 43 | + POSITIONAL_ARGS+=("$1") # save positional arg |
| 44 | + shift |
| 45 | + ;; |
| 46 | + esac |
| 47 | +done |
| 48 | + |
| 49 | +set -- "${POSITIONAL_ARGS[@]}" |
5 | 50 |
|
6 | 51 | TOPDIR=$(dirname $(realpath $0))
|
7 | 52 |
|
@@ -39,7 +84,7 @@ export PYTHONPYCACHEPREFIX=$TMPDIR/pycache
|
39 | 84 | DETECTION_PARAMETERS=''
|
40 | 85 | GENERIC=0
|
41 | 86 | EB='eb'
|
42 |
| -if [[ "$1" == "--generic" || "$EASYBUILD_OPTARCH" == "GENERIC" ]]; then |
| 87 | +if [[ "$EASYBUILD_OPTARCH" == "GENERIC" ]]; then |
43 | 88 | echo_yellow ">> GENERIC build requested, taking appropriate measures!"
|
44 | 89 | DETECTION_PARAMETERS="$DETECTION_PARAMETERS --generic"
|
45 | 90 | GENERIC=1
|
@@ -305,6 +350,8 @@ fail_msg="Installation of WRF failed, that's unexpected..."
|
305 | 350 | OMPI_MCA_pml=ucx UCX_TLS=tcp $EB WRF-3.9.1.1-foss-2020a-dmpar.eb -r --include-easyblocks-from-pr 2648
|
306 | 351 | check_exit_code $? "${ok_msg}" "${fail_msg}"
|
307 | 352 |
|
| 353 | +### add packages here |
| 354 | + |
308 | 355 | echo ">> Creating/updating Lmod cache..."
|
309 | 356 | export LMOD_RC="${EASYBUILD_INSTALLPATH}/.lmod/lmodrc.lua"
|
310 | 357 | if [ ! -f $LMOD_RC ]; then
|
|
0 commit comments