1
- # /usr/bin/env bash
1
+ #! /usr/bin/env bash
2
2
#
3
3
# windows-install.sh
4
4
#
@@ -121,6 +121,7 @@ if [[ "${arg_d}" == "${__flag_present}" ]]; then
121
121
fi
122
122
123
123
# Get linux_distribution name
124
+ # shellcheck disable=SC2154
124
125
{
125
126
info " __file: ${__file} "
126
127
info " __dir: ${__dir} "
@@ -144,7 +145,8 @@ info "-V (--version-number): ${arg_V}"
144
145
145
146
# __________ Process command-line arguments and environment variables _____________
146
147
147
- export this_script=" $( basename " $0 " ) "
148
+ this_script=" $( basename " $0 " ) "
149
+ export this_script
148
150
debug " this_script=\" ${this_script} \" "
149
151
150
152
export install_prefix=" ${arg_i%/:- ${PWD} / prerequisites/ installations} "
@@ -165,7 +167,7 @@ verify_this_is_ubuntu()
165
167
if [[ ${__os} != " Linux" ]]; then
166
168
emergency " ${__os} not supported: this script is intended for use in Windows Subsystem for Linux "
167
169
fi
168
- linux_standard_base_i=` lsb_release -i`
170
+ linux_standard_base_i=$( lsb_release -i)
169
171
untrimmed_name=${linux_standard_base_i##* Distributor ID: }
170
172
linux_distribution=" ${untrimmed_name// [[:space:]]/ } "
171
173
info " Linux distribution: ${linux_distribution} "
@@ -180,7 +182,7 @@ verify_this_is_ubuntu
180
182
# Ubuntu 16.04 apt-get installs gfortran 5.4.0 or later, which is acceptable for many uses of OpenCoarrays
181
183
verify_acceptable_release_number ()
182
184
{
183
- linux_standard_base_r=` lsb_release -r`
185
+ linux_standard_base_r=$( lsb_release -r)
184
186
untrimmed_name=${linux_standard_base_r##* Release: }
185
187
release_number=" ${untrimmed_name// [[:space:]]/ } "
186
188
major_release=" ${release_number%% .* } "
@@ -260,20 +262,20 @@ else
260
262
fi
261
263
}
262
264
set_SUDO_if_needed_to_write_to_install_dir
263
-
265
+
264
266
# Install OpenCoarrays
265
267
266
268
if [[ -d " $build_path " ]]; then
267
269
rm -rf " $build_path "
268
270
fi
269
271
mkdir -p " $build_path "
270
- cd " $build_path "
272
+ cd " $build_path " || exit 25
271
273
info " Configuring OpenCoarrays with the following command:"
272
274
info " FC=\" $FC \" CC=\" $CC \" \" $CMAKE \" \" $OPENCOARRAYS_SRC_DIR \" -DCMAKE_INSTALL_PREFIX=\" $install_prefix \" "
273
275
FC=" $FC " CC=" $CC " " $CMAKE " " $OPENCOARRAYS_SRC_DIR " -DCMAKE_INSTALL_PREFIX=" $install_prefix "
274
276
info " Building OpenCoarrays with the following command:"
275
277
info " make -j $arg_j "
276
- make -j $ arg_j
278
+ make -j " ${ arg_j} "
277
279
info " Installing OpenCoarrays with the following command:"
278
280
info " ${SUDO:- } make install"
279
281
${SUDO:- } make install
285
287
emergency " $install_prefix "
286
288
fi
287
289
# See http://stackoverflow.com/questions/31057694/gethostbyname-fail-after-switching-internet-connections/31222970
288
- loopback_line=` grep $ NAME /etc/hosts`
290
+ loopback_line=$( grep " ${ NAME} " /etc/hosts)
289
291
if [[ -z " ${loopback_line:- } " ]]; then
290
292
info " To ensure the correct functioning of MPI, please add the following line to your /etc/hosts file:"
291
293
info " 127.0.0.1 $NAME "
0 commit comments