Skip to content

Commit a2f8fdc

Browse files
committed
Fix shellcheck issues in install-ofp.sh
1 parent a943037 commit a2f8fdc

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

prerequisites/install-ofp.sh

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ if [[ ! -f "${B3B_USE_CASE:-}/bootstrap.sh" ]]; then
4242
echo "Please set B3B_USE_CASE to the bash3boilerplate use-case directory path."
4343
exit 2
4444
fi
45+
# shellcheck source=./use-case/bootstrap.sh
4546
source "${B3B_USE_CASE}/bootstrap.sh" "$@"
4647

4748
# Set up a function to call when receiving an EXIT signal to do some cleanup. Remove if
@@ -53,57 +54,63 @@ trap cleanup_before_exit EXIT # The signal is specified here. Could be SIGINT, S
5354

5455
export __flag_present=1
5556

56-
# Verify requirements
57+
# Verify requirements
5758

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

61+
# shellcheck disable=SC2154
6062
if [[ "${__os}" != "OSX" ]]; then
6163
info "${__base} currently installs binaries that work only on OS X"
6264
emergency "To request other platforms, please submit an issue at http://github.com/sourceryinstitute/opencoarrays/issues"
6365
fi
6466

6567
default_ofp_downloader=wget
66-
# If -D is passed, print the download programs used for OFP and its prerequisites.
68+
# If -D is passed, print the download programs used for OFP and its prerequisites.
6769
# Then exit with normal status.
70+
# shellcheck disable=SC2154
6871
if [[ "${arg_D}" == "${__flag_present}" ]]; then
69-
echo "strategoxt-superbundle downloader: `${OPENCOARRAYS_SRC_DIR}/prerequisites/install-binary.sh -D strategoxt-superbundle`"
72+
echo "strategoxt-superbundle downloader: $("${OPENCOARRAYS_SRC_DIR}/prerequisites/install-binary.sh" -D strategoxt-superbundle)"
7073
echo "ofp-sdf default downloader: ${default_ofp_downloader}"
7174
exit 0
7275
fi
7376

74-
# If -P is passed, print the default installation paths for OFP and its prerequisites.
77+
# If -P is passed, print the default installation paths for OFP and its prerequisites.
7578
# Then exit with normal status.
7679
default_ofp_install_path="${OPENCOARRAYS_SRC_DIR}/prerequisites/installations"
7780
install_path="${arg_i:-"${default_ofp_install_path}"}"
7881
strategoxt_superbundle_install_path="/opt"
82+
# shellcheck disable=SC2154
7983
if [[ "${arg_P}" == "${__flag_present}" ]]; then
8084
echo "strategoxt-superbundle default installation path: ${strategoxt_superbundle_install_path}"
8185
echo "ofp default installation path: ${default_ofp_install_path}"
8286
exit 0
8387
fi
8488

85-
# If -V is passed, print the default versions of OFP and its prerequisites.
89+
# If -V is passed, print the default versions of OFP and its prerequisites.
8690
# Then exit with normal status.
8791
default_ofp_version=sdf
92+
# shellcheck disable=SC2154
8893
if [[ "${arg_V}" == "${__flag_present}" ]]; then
89-
echo "strategoxt-superbundle default version: `${OPENCOARRAYS_SRC_DIR}/prerequisites/install-binary.sh -V strategoxt-superbundle`"
94+
echo "strategoxt-superbundle default version: $("${OPENCOARRAYS_SRC_DIR}/prerequisites/install-binary.sh" -V strategoxt-superbundle)"
9095
echo "ofp default version: ${default_ofp_version}"
9196
exit 0
9297
fi
9398

94-
# If -U is passed, print the URLs for OFP and its prerequisites.
99+
# If -U is passed, print the URLs for OFP and its prerequisites.
95100
# Then exit with normal status.
96101
ofp_URL="https://github.com/sourceryinstitute/opencoarrays/files/213108/ofp-sdf.tar.gz"
102+
# shellcheck disable=SC2154
97103
if [[ "${arg_U}" == "${__flag_present}" ]]; then
98-
echo "strategoxt-superbundle URL: `${OPENCOARRAYS_SRC_DIR}/prerequisites/install-binary.sh -U strategoxt-superbundle`"
104+
echo "strategoxt-superbundle URL: $("${OPENCOARRAYS_SRC_DIR}/prerequisites/install-binary.sh" -U strategoxt-superbundle)"
99105
echo "ofp URL: ${ofp_URL}"
100106
exit 0
101107
fi
102108

103-
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
109+
### Print bootstrapped magic variables to STDERR when LOG_LEVEL
104110
### is at the default value (6) or above.
105111
#####################################################################
106-
112+
# shellcheck disable=SC2154
113+
{
107114
info "__file: ${__file}"
108115
info "__dir: ${__dir}"
109116
info "__base: ${__base}"
@@ -122,7 +129,7 @@ info "-n (--no-color): ${arg_n}"
122129
info "-P (--print-path): ${arg_P}"
123130
info "-U (--print-url): ${arg_U}"
124131
info "-V (--print-version): ${arg_V}"
125-
132+
}
126133
# Set OFP installation path to the value of the -i argument if present.
127134
# Otherwise, install OFP in the OpenCoarrays prerequisites/installations directory.
128135
opencoarrays_prerequisites_dir="${OPENCOARRAYS_SRC_DIR}"/prerequisites/
@@ -135,6 +142,7 @@ fi
135142
ofp_prereqs_install_dir="/opt"
136143
# Change present working directory to installation directory
137144
if [[ ! -d "${install_path}" ]]; then
145+
# shellcheck source=./build-functions/set_SUDO_if_needed_to_write_to_directory.sh
138146
source "${opencoarrays_prerequisites_dir}/build-functions/set_SUDO_if_needed_to_write_to_directory.sh"
139147
set_SUDO_if_needed_to_write_to_directory "${install_path}"
140148
${SUDO:-} mkdir -p "${install_path}"
@@ -153,6 +161,7 @@ export SDF2_PATH="${ofp_prereqs_install_dir}"/sdf2-bundle/v2.4/bin
153161
export ST_PATH="${ofp_prereqs_install_dir}"/strategoxt/v0.17/bin
154162
export DYLD_LIBRARY_PATH="${ofp_prereqs_install_dir}"/strategoxt/v0.17/lib:/opt/aterm/v2.5/lib
155163

156-
OFP_HOME="${install_path}"/ofp-sdf
164+
export OFP_HOME="${install_path}"/ofp-sdf
165+
# shellcheck source=./install-binary-functions/build_parse_table.sh
157166
source "${opencoarrays_prerequisites_dir}"/install-binary-functions/build_parse_table.sh
158167
build_parse_table

0 commit comments

Comments
 (0)