-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy path.env
51 lines (45 loc) · 2.11 KB
/
.env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
# This file defines environment variables used by the CO𝘕CEPT code.
# You may manually hard code environment variables using the syntax
# export name="value"
# For PATH-like environment variables, it can be preferable not to
# hard code values, as overwriting the current values may be harmful.
# You may instead place pairs of PATH-like environment variable names
# and values in the pathenv_name_value_pairs_custom array below, e.g.
# pathenv_name_value_pairs_custom=(SOME_PATH "/some/path" OTHER_PATH "/other/path")
# If a given PATH-like environment variable is not already defined,
# it will be assigned the corresponding value. If it already exists,
# the value will be prepended/appended (as specified by the
# concatenate variable), using a colon as separator.
concatenate="prepend"
pathenv_name_value_pairs_custom=()
# The MPI executor (usually srun or mpiexec/mpirun, perhaps with some
# options) is the executable responsible for launching CO𝘕CEPT runs
# as MPI programs, when submitted as jobs on a cluster. Here you can
# overrule the automatically generated values for the MPI executor
# appearing in job scripts.
export mpi_executor=""
# Set make_jobs="-j <n>" for parallel builds using n processes
export make_jobs=""
# Filled in at install time
pathenv_name_value_pairs_installtime=()
# Update the environment
pathenv_name_value_pairs=( \
"${pathenv_name_value_pairs_installtime[@]}" \
"${pathenv_name_value_pairs_custom[@]}" \
)
for ((name_index=0; name_index<${#pathenv_name_value_pairs[@]}; name_index+=2)); do
((value_index = name_index + 1))
name=${pathenv_name_value_pairs[${name_index}]}
value="${pathenv_name_value_pairs[${value_index}]}"
preset="$(eval "echo \${${name}}")"
if [ -z "${preset}" ]; then
eval "export ${name}=\"${value}\""
elif [[ "${preset}" != *"${value}" ]]; then
if [[ "${concatenate}" == "prepend"* ]]; then
eval "export ${name}=\"${value}:${preset}\""
elif [[ "${concatenate}" == "append"* ]]; then
eval "export ${name}=\"${preset}:${value}\""
fi
fi
done