Skip to content

Commit a943037

Browse files
committed
Fix shellcheck issues in install-binary.sh
1 parent 2363403 commit a943037

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

prerequisites/install-binary.sh

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# - Build OpenCoarrays prerequisite packages and their prerequisites
77
#
8-
# Usage: LOG_LEVEL=7 B3B_USE_CASE=/opt/bash3boilerplate/src/use-case ./my-script.sh -f script_input.txt
8+
# Usage: LOG_LEVEL=7 B3B_USE_CASE=/opt/bash3boilerplate/src/use-case ./my-script.sh -f script_input.txt
99
#
1010
# More info:
1111
#
@@ -28,18 +28,19 @@
2828
# (1) Import several bash3boilerplate helper functions & default settings.
2929
# (2) Set several variables describing the current file and its usage page.
3030
# (3) Parse the usage information (default usage file name: current file's name with -usage appended).
31-
# (4) Parse the command line using the usage information.
31+
# (4) Parse the command line using the usage information.
3232

3333
export __usage="${OPENCOARRAYS_SRC_DIR}/prerequisites/install-binary.sh-usage"
3434

3535
### Start of boilerplate -- do not edit this block #######################
3636
if [[ ! -f "${B3B_USE_CASE:-}/bootstrap.sh" ]]; then
37-
echo "Please set B3B_USE_CASE to the bash3boilerplate use-case directory path."
37+
echo "Please set B3B_USE_CASE to the bash3boilerplate use-case directory path."
3838
exit 1
3939
elif [[ ! -d "${OPENCOARRAYS_SRC_DIR:-}" ]]; then
40-
echo "Please set OPENCOARRAYS_SRC_DIR to the OpenCoarrays source directory path."
40+
echo "Please set OPENCOARRAYS_SRC_DIR to the OpenCoarrays source directory path."
4141
exit 2
4242
else
43+
# shellcheck source=./use-case/bootstrap.sh
4344
source "${B3B_USE_CASE}/bootstrap.sh" "$@"
4445
fi
4546
### End of boilerplate -- start user edits below #########################
@@ -56,14 +57,14 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
5657
#####################################################################
5758

5859
export __flag_present=1
59-
60-
if [[ "${arg_l}" != "${__flag_present}" && "${arg_N}" != "${__flag_present}" &&
60+
# shellcheck disable=SC2154
61+
if [[ "${arg_l}" != "${__flag_present}" && "${arg_N}" != "${__flag_present}" &&
6162
"${arg_v}" != "${__flag_present}" && "${arg_h}" != "${__flag_present}" &&
6263
-z "${arg_D:-${arg_p:-${arg_P:-${arg_U:-${arg_V}}}}}" ]]; then
6364
help "${__base}: Insufficient arguments. Please pass either -D, -h, -N, -l, -p, -P, -U, -v, -V, or a longer equivalent."
6465
fi
6566

66-
# Suppress info and debug messages if -l, -P, -U, -V, -D, or their longer equivalent is present:
67+
# Suppress info and debug messages if -l, -P, -U, -V, -D, or their longer equivalent is present:
6768
[[ "${arg_l}" == "${__flag_present}" || ! -z "${arg_P:-${arg_U:-${arg_V:-${arg_D}}}}" ]] && suppress_info_debug_messages
6869

6970
[ -z "${LOG_LEVEL:-}" ] && emergency "Cannot continue without LOG_LEVEL. "
@@ -73,10 +74,11 @@ fi
7374
[ ! -z "${arg_P:-}" ] && [ ! -z "${arg_U:-}" ] && emergency "Only specify one of -P, -U, -V, or their long-form equivalents."
7475
[ ! -z "${arg_U:-}" ] && [ ! -z "${arg_V:-}" ] && emergency "Only specify one of -P, -U, -V, or their long-form equivalents."
7576

76-
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
77+
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
7778
### is at the default value (6) or above.
7879
#####################################################################
79-
80+
# shellcheck disable=SC2154
81+
{
8082
info "__file: ${__file}"
8183
info "__dir: ${__dir}"
8284
info "__base: ${__base}"
@@ -93,35 +95,44 @@ info "-I (--install-version): ${arg_I} "
9395
info "-l (--list-packages): ${arg_l} "
9496
info "-n (--no-color): ${arg_n} "
9597
info "-p (--package): ${arg_p}"
96-
info "-P (--print-path): ${arg_P} "
98+
info "-P (--print-path): ${arg_P} "
9799
info "-U (--print-url): ${arg_U} "
98100
info "-v (--version): ${arg_v} "
99101
info "-V (--print-version): ${arg_V} "
100-
102+
}
103+
# shellcheck source=./install-binary-functions/set_or_print_default_version.sh
101104
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/install-binary-functions/set_or_print_default_version.sh"
102105
set_or_print_default_version
103106
export version_to_build="${arg_I:-${default_version}}"
104107

108+
# shellcheck source=./install-binary-functions/set_or_print_downloader.sh
105109
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/install-binary-functions/set_or_print_downloader.sh"
106110
set_or_print_downloader
107111

112+
# shellcheck source=./install-binary-functions/set_or_print_url.sh
108113
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/install-binary-functions/set_or_print_url.sh"
109114
set_or_print_url
110115

116+
# shellcheck source=./build-functions/set_or_print_installation_path.sh
111117
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_or_print_installation_path.sh"
112118
set_or_print_installation_path
113119

120+
# shellcheck source=./build-functions/download_if_necessary.sh
114121
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/download_if_necessary.sh"
115122
download_if_necessary
116123

124+
# shellcheck source=./build-functions/unpack_if_necessary.sh
117125
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/unpack_if_necessary.sh"
118126
unpack_if_necessary
119127

128+
# shellcheck source=./install-binary-functions/set_or_print_csv_binary_names.sh
120129
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/install-binary-functions/set_or_print_csv_binary_names.sh"
121130
set_or_print_csv_binary_names
122131

132+
# shellcheck source=./build-functions/set_SUDO_if_needed_to_write_to_directory.sh
123133
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/build-functions/set_SUDO_if_needed_to_write_to_directory.sh"
124134
set_SUDO_if_needed_to_write_to_directory /opt
125135

136+
# shellcheck source=./install-binary-functions/move_binaries_to_install_path.sh
126137
source "${OPENCOARRAYS_SRC_DIR:-}/prerequisites/install-binary-functions/move_binaries_to_install_path.sh"
127138
move_binaries_to_install_path

0 commit comments

Comments
 (0)