Skip to content

Commit fbe82f7

Browse files
committed
Address shellcheck issues in install.sh
Meaningless issues silenced, all others addressed
1 parent ca51723 commit fbe82f7

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

install.sh

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ if [[ ! -f "${B3B_USE_CASE:-}/bootstrap.sh" ]]; then
9191
echo "Please set B3B_USE_CASE to the bash3boilerplate use-case directory path."
9292
exit 2
9393
else
94-
source "${B3B_USE_CASE}/bootstrap.sh" "$@"
94+
# shellcheck source=./prerequisites/use-case/bootstrap.sh
95+
source "${B3B_USE_CASE}/bootstrap.sh" "$@"
9596
fi
9697
### End of boilerplate -- start user edits below #########################
9798

@@ -111,6 +112,7 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
111112

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

115+
# shellcheck disable=SC2154
114116
if [[ "${arg_v}" == "${__flag_present}" || "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]]; then
115117
print_debug_only=7
116118
if [ "$(( LOG_LEVEL < print_debug_only ))" -ne 0 ]; then
@@ -131,7 +133,8 @@ fi
131133
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
132134
### is at the default value (6) or above.
133135
#####################################################################
134-
136+
# shellcheck disable=SC2154
137+
{
135138
info "__file: ${__file}"
136139
info "__dir: ${__dir}"
137140
info "__base: ${__base}"
@@ -158,7 +161,7 @@ info "-P (--print-path): ${arg_P}"
158161
info "-U (--print-url): ${arg_U}"
159162
info "-v (--version): ${arg_v}"
160163
info "-V (--print-version): ${arg_V}"
161-
164+
}
162165
# This file is organized into three sections:
163166
# 1. Command-line argument and environment variable processing.
164167
# 2. Function definitions.
@@ -182,7 +185,8 @@ info "-V (--print-version): ${arg_V}"
182185

183186
# __________ Process command-line arguments and environment variables _____________
184187

185-
export this_script=`basename $0`
188+
this_script="$(basename "$0")"
189+
export this_script
186190

187191
export install_path="${arg_i}/${arg_p}"
188192
info "install_path=${arg_i}/${arg_p}"
@@ -204,15 +208,19 @@ info "build_script=$opencoarrays_src_dir/prerequisites/build.sh"
204208

205209
# Include stack management functions
206210
#. ./prerequisites/stack.sh
211+
# shellcheck source=./prerequisites/stack.sh
207212
source $opencoarrays_src_dir/prerequisites/stack.sh
208213
stack_new dependency_pkg
209214
stack_new dependency_exe
210215
stack_new dependency_path
211216
stack_new script_installed
212-
217+
# shellcheck source=./prerequisites/install-functions/find_or_install.sh
213218
source $opencoarrays_src_dir/prerequisites/install-functions/find_or_install.sh
219+
# shellcheck source=./prerequisites/install-functions/print_header.sh
214220
source $opencoarrays_src_dir/prerequisites/install-functions/print_header.sh
221+
# shellcheck source=./prerequisites/install-functions/build_opencoarrays.sh
215222
source $opencoarrays_src_dir/prerequisites/install-functions/build_opencoarrays.sh
223+
# shellcheck source=./prerequisites/install-functions/report_results.sh
216224
source $opencoarrays_src_dir/prerequisites/install-functions/report_results.sh
217225

218226
# ___________________ End of function definitions for use in the Main Body __________________
@@ -224,7 +232,7 @@ source $opencoarrays_src_dir/prerequisites/install-functions/report_results.sh
224232
if [[ "${arg_v}" == "${__flag_present}" || "${arg_V}" == "opencoarrays" ]]; then
225233

226234
# Print script copyright if invoked with -v, -V, or --version argument
227-
cmake_project_line=`grep project CMakeLists.txt | grep VERSION`
235+
cmake_project_line=$(grep project CMakeLists.txt | grep VERSION)
228236
text_after_version_keyword="${cmake_project_line##*VERSION}"
229237
text_before_language_keyword="${text_after_version_keyword%%LANGUAGES*}"
230238
opencoarrays_version=$text_before_language_keyword
@@ -256,14 +264,15 @@ elif [[ ! -z "${arg_D:-${arg_P:-${arg_U:-${arg_V}}}}" || "${arg_l}" == "${__fla
256264
"${opencoarrays_src_dir}"/prerequisites/build.sh "${build_flag}" "${build_arg}"
257265
# Add lines other packages the current script builds
258266
if [[ "${arg_l}" == "${__flag_present}" ]]; then
259-
echo "opencoarrays (version `${opencoarrays_src_dir}/install.sh -V opencoarrays`)"
267+
echo "opencoarrays (version $("${opencoarrays_src_dir}/install.sh" -V opencoarrays))"
260268
echo "ofp (version: ofp-sdf for OS X )"
261269
fi
262270

263271
elif [[ "${arg_p:-}" == "opencoarrays" ]]; then
264272

265-
cd prerequisites
273+
cd prerequisites || exit 1
266274
installation_record=install-opencoarrays.log
275+
# shellcheck source=./prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh
267276
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh"
268277
set_SUDO_if_needed_to_write_to_directory "${install_path}"
269278
build_opencoarrays 2>&1 | tee ../"${installation_record}"

0 commit comments

Comments
 (0)