@@ -109,12 +109,12 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
109
109
# ## Validation (decide what's required for running your script and error out)
110
110
# ####################################################################
111
111
112
- [ -z " ${LOG_LEVEL:- } " ] && emergency " Cannot continue without LOG_LEVEL. "
112
+ [[ -z " ${LOG_LEVEL:- } " ] ] && emergency " Cannot continue without LOG_LEVEL. "
113
113
114
114
# shellcheck disable=SC2154
115
- if [[ " ${arg_d} " == " ${__flag_present} " ]]; then
115
+ if [[ " ${arg_d} " == " ${__flag_present} " ]]; then
116
116
print_debug_only=7
117
- if [ " $(( LOG_LEVEL < print_debug_only )) " -ne 0 ]; then
117
+ if [[ " $(( LOG_LEVEL < print_debug_only )) " -ne 0 ] ]; then
118
118
debug " Supressing info and debug messages: one of {-l, -v, -P, -U, -V, -D} present."
119
119
suppress_info_debug_messages
120
120
fi
@@ -145,7 +145,7 @@ info "-V (--version-number): ${arg_V}"
145
145
146
146
# __________ Process command-line arguments and environment variables _____________
147
147
148
- this_script=" $( basename " $0 " ) "
148
+ this_script=" $( basename " ${0} " ) "
149
149
export this_script
150
150
debug " this_script=\" ${this_script} \" "
151
151
@@ -157,7 +157,7 @@ info "num_threads=\"${arg_j}\""
157
157
158
158
opencoarrays_version=$( sed -n ' /[0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}/{s/^\([^.]*\)\([0-9]\{1,\}\(\.[0-9]\{1,\}\)\{1,\}\)\(.*\)/\2/p;q;}' " ${OPENCOARRAYS_SRC_DIR%/ } /.VERSION" )
159
159
160
- export build_path=" ${OPENCOARRAYS_SRC_DIR%/ } " /prerequisites/builds/opencoarrays/$opencoarrays_version
160
+ export build_path=" ${OPENCOARRAYS_SRC_DIR%/ } " /prerequisites/builds/opencoarrays/${ opencoarrays_version}
161
161
info " build_path=\" ${build_path} \" "
162
162
163
163
export CMAKE=" ${arg_m:- cmake} "
@@ -188,10 +188,10 @@ verify_acceptable_release_number()
188
188
major_release=" ${release_number%% .* } "
189
189
minor_release=" ${release_number##* .} "
190
190
info " Release: ${major_release} .${minor_release} "
191
- if [[ $major_release -lt 16 ]]; then
191
+ if [[ ${ major_release} -lt 16 ]]; then
192
192
emergency " Please upgrade to Windows Subsystem for Linux (WSL) Ubuntu 16.04 or later."
193
- elif [[ $major_release -eq 16 ]]; then
194
- if [[ $minor_release -lt " 04" ]]; then
193
+ elif [[ ${ major_release} -eq 16 ]]; then
194
+ if [[ ${ minor_release} -lt " 04" ]]; then
195
195
emergency " Please upgrade to Windows Subsystem for Linux (WSL) Ubuntu 16.04 or later."
196
196
fi
197
197
fi
@@ -200,7 +200,7 @@ verify_acceptable_release_number
200
200
201
201
if [[ " ${arg_V} " == " ${__flag_present} " ]]; then
202
202
# Print just the version number
203
- info " $opencoarrays_version "
203
+ info " ${ opencoarrays_version} "
204
204
205
205
elif [[ " ${arg_v} " == " ${__flag_present} " ]]; then
206
206
@@ -221,19 +221,19 @@ else
221
221
export FC=${arg_f:- gfortran}
222
222
export CC=${arg_c:- gcc}
223
223
export CXX=${arg_C:- g++}
224
-
224
+
225
225
# Check for and, if necessary, install OpenCoarrays prerequisites
226
226
227
- if ! type " $CMAKE " >& /dev/null; then
227
+ if ! type " ${ CMAKE} " >& /dev/null; then
228
228
sudo apt-get install cmake
229
229
fi
230
- if ! type " $CXX " >& /dev/null; then
230
+ if ! type " ${ CXX} " >& /dev/null; then
231
231
sudo apt-get install g++
232
232
fi
233
- if ! type " $FC " >& /dev/null; then
233
+ if ! type " ${FC} " >& /dev/null; then
234
234
sudo apt-get install gfortran
235
235
fi
236
-
236
+
237
237
if ! type mpifort >& /dev/null; then
238
238
sudo apt-get install mpich
239
239
fi
@@ -265,31 +265,31 @@ else
265
265
266
266
# Install OpenCoarrays
267
267
268
- if [[ -d " $build_path " ]]; then
269
- rm -rf " $build_path "
268
+ if [[ -d " ${ build_path} " ]]; then
269
+ rm -rf " ${ build_path} "
270
270
fi
271
- mkdir -p " $build_path "
272
- cd " $build_path " || exit 25
271
+ mkdir -p " ${ build_path} "
272
+ cd " ${ build_path} " || exit 25
273
273
info " Configuring OpenCoarrays with the following command:"
274
- info " FC=\" $FC \" CC=\" $CC \" \" $CMAKE \" \" $OPENCOARRAYS_SRC_DIR \" -DCMAKE_INSTALL_PREFIX=\" $install_prefix \" "
275
- FC=" $FC " CC=" $CC " " $CMAKE " " $OPENCOARRAYS_SRC_DIR " -DCMAKE_INSTALL_PREFIX=" $install_prefix "
274
+ info " FC=\" ${FC} \" CC=\" ${CC} \" \" ${ CMAKE} \" \" ${ OPENCOARRAYS_SRC_DIR} \" -DCMAKE_INSTALL_PREFIX=\" ${ install_prefix} \" "
275
+ FC=" ${FC} " CC=" ${CC} " " ${ CMAKE} " " ${ OPENCOARRAYS_SRC_DIR} " -DCMAKE_INSTALL_PREFIX=" ${ install_prefix} "
276
276
info " Building OpenCoarrays with the following command:"
277
- info " make -j $arg_j "
277
+ info " make -j ${ arg_j} "
278
278
make -j " ${arg_j} "
279
279
info " Installing OpenCoarrays with the following command:"
280
280
info " ${SUDO:- } make install"
281
281
${SUDO:- } make install
282
- if [[ -f " $install_prefix " /lib/libcaf_mpi.a && -f " ${install_prefix} /bin/caf" && -f " ${install_prefix} /bin/cafrun" ]]; then
282
+ if [[ -f " ${ install_prefix} " /lib/libcaf_mpi.a && -f " ${install_prefix} /bin/caf" && -f " ${install_prefix} /bin/cafrun" ]]; then
283
283
info " OpenCoarrays has been installed in"
284
- info " $install_prefix "
284
+ info " ${ install_prefix} "
285
285
else
286
286
info " Something went wrong. OpenCoarrays is not in the expected location:"
287
- emergency " $install_prefix "
287
+ emergency " ${ install_prefix} "
288
288
fi
289
289
# See http://stackoverflow.com/questions/31057694/gethostbyname-fail-after-switching-internet-connections/31222970
290
290
loopback_line=$( grep " ${NAME} " /etc/hosts)
291
291
if [[ -z " ${loopback_line:- } " ]]; then
292
292
info " To ensure the correct functioning of MPI, please add the following line to your /etc/hosts file:"
293
- info " 127.0.0.1 $NAME "
293
+ info " 127.0.0.1 ${ NAME} "
294
294
fi
295
295
fi
0 commit comments