Skip to content

Commit bb19966

Browse files
rousonzbeekman
authored andcommitted
Done install.sh refactor: replaces build->build.sh
1 parent 1e2ad96 commit bb19966

File tree

6 files changed

+63
-561
lines changed

6 files changed

+63
-561
lines changed

install.sh

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,22 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
110110

111111
[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "
112112

113-
[ ! -z "${arg_D}" ] && [ ! -z "${arg_p:-${arg_P:-${arg_U:-${arg_V}}}}" ] &&
114-
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
113+
if [[ "${arg_v}" == "${__flag_present}" || "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]]; then
114+
print_debug_only=7
115+
if [ "$(( LOG_LEVEL < print_debug_only ))" -ne 0 ]; then
116+
debug "Supressing info and debug messages: one of {-l, -v, -P, -U, -V, -D} present."
117+
suppress_info_debug_messages
118+
fi
119+
fi
115120

116-
[ ! -z "${arg_p}" ] && [ ! -z "${arg_P:-${arg_U:-${arg_V}}}" ] &&
117-
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
121+
[ ! -z "${arg_D}" ] && [ ! -z "${arg_P:-${arg_U:-${arg_V}}}" ] &&
122+
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 101]"
118123

119124
[ ! -z "${arg_P}" ] && [ ! -z "${arg_U:-${arg_V}}" ] &&
120-
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
125+
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 103]"
121126

122127
[ ! -z "${arg_U}" ] && [ ! -z "${arg_V}" ] &&
123-
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected)."
124-
125-
if [[ "${arg_v}" == "${__flag_present}" || "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]]; then
126-
debug "Supressing info and debug messages: one of {-l, -v, -P, -U, -V, -D} present."
127-
suppress_info_debug_messages
128-
fi
128+
emergency "Please pass only one of {-D, -p, -P, -U, -V} or a longer equivalent (multiple detected). [exit 104]"
129129

130130
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
131131
### is at the default value (6) or above.
@@ -183,17 +183,17 @@ info "-V (--print-version): ${arg_V}"
183183

184184
export this_script=`basename $0`
185185

186-
export install_path="${arg_i}"
187-
info "install_path=${arg_i}"
186+
export install_path="${arg_i}/${arg_p}"
187+
info "install_path=${arg_i}/${arg_p}"
188188

189189
export num_threads="${arg_j}"
190190
info "num_threads=${arg_j}"
191191

192192
export opencoarrays_src_dir="${OPENCOARRAYS_SRC_DIR}"
193193
info "opencoarrays_src_dir=${OPENCOARRAYS_SRC_DIR}"
194194

195-
export build_path=$opencoarrays_src_dir/prerequisites/build_directories
196-
info "build_path=$opencoarrays_src_dir/prerequisites/build_directories"
195+
export build_path=$opencoarrays_src_dir/prerequisites/builds
196+
info "build_path=$opencoarrays_src_dir/prerequisites/builds"
197197

198198
export build_script=$opencoarrays_src_dir/prerequisites/build.sh
199199
info "build_script=$opencoarrays_src_dir/prerequisites/build.sh"
@@ -243,13 +243,20 @@ if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
243243
echo "${opencoarrays_version}"
244244
fi
245245

246-
elif [[ "${arg_l}" == "${__flag_present}" ]]; then
246+
elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}" || "${arg_l}" == "${__flag_present}" ]]; then
247247

248-
"${opencoarrays_src_dir}"/prerequisites/build.sh -l
248+
# Delegate to build.sh
249+
build_arg=${arg_D:-${arg_P:-${arg_U:-${arg_V:-${arg_p}}}}}
250+
[ ! -z "${arg_D}" ] && build_flag="-D"
251+
[ ! -z "${arg_P}" ] && build_flag="-P"
252+
[ ! -z "${arg_U}" ] && build_flag="-U"
253+
[ ! -z "${arg_V}" ] && build_flag="-V"
254+
[ "${arg_l}" == "${__flag_present}" ] && build_flag="-l"
255+
"${opencoarrays_src_dir}"/prerequisites/build.sh "${build_flag}" "${build_arg}"
249256

250257
elif [[ ! -z "${arg_p:-}" && "${arg_p:-}" != "opencoarrays" ]]; then
251258

252-
"${opencoarrays_src_dir}"/prerequisites/build.sh -p "${arg_p}"
259+
"${opencoarrays_src_dir}"/prerequisites/build.sh -p "${arg_p}"
253260

254261
else # Find or install prerequisites and install OpenCoarrays
255262

0 commit comments

Comments
 (0)