Skip to content

Commit 1598339

Browse files
committed
Fix #452, Fix #460: Remove dead code and fix indentation
- Remove unreachable exit 1 on line 88 of bin/tfenv (Fix #452) - Fix mixed indentation in auto-install block of lib/tfenv-exec.sh (Fix #460) - Add SHA256 hash success log message in tfenv-install for user visibility
1 parent a3c943e commit 1598339

3 files changed

Lines changed: 10 additions & 9 deletions

File tree

bin/tfenv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ case "${arg}" in
8484
tfenv---version;
8585
tfenv-help;
8686
} | abort && exit 1;
87-
exit 1;
8887
;;
8988
-v | --version )
9089
log 'debug' 'tfenv version requested...';

lib/tfenv-exec.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ function tfenv-exec() {
5050
export TFENV_VERSION;
5151

5252
if [ ! -d "${TFENV_CONFIG_DIR}/versions/${TFENV_VERSION}" ]; then
53-
if [ "${TFENV_AUTO_INSTALL:-true}" == "true" ]; then
54-
if [ -z "${TFENV_TERRAFORM_VERSION:-""}" ]; then
55-
TFENV_VERSION_SOURCE="$(tfenv-version-file)";
56-
else
57-
TFENV_VERSION_SOURCE='TFENV_TERRAFORM_VERSION';
58-
fi;
53+
if [ "${TFENV_AUTO_INSTALL:-true}" == "true" ]; then
54+
if [ -z "${TFENV_TERRAFORM_VERSION:-""}" ]; then
55+
TFENV_VERSION_SOURCE="$(tfenv-version-file)";
56+
else
57+
TFENV_VERSION_SOURCE='TFENV_TERRAFORM_VERSION';
58+
fi;
5959
log 'info' "version '${TFENV_VERSION}' is not installed (set by ${TFENV_VERSION_SOURCE}). Installing now as TFENV_AUTO_INSTALL==true";
6060
tfenv-install;
6161
else

libexec/tfenv-install

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,13 +280,15 @@ if [[ -n "${shasum_bin}" && -x "${shasum_bin}" ]]; then
280280
-a 256 \
281281
-s \
282282
-c <(grep -F "${tarball_name}" "${shasums_name}")
283-
) || log 'error' 'SHA256 hash does not match!';
283+
) && log 'info' 'SHA256 hash matched!' \
284+
|| log 'error' 'SHA256 hash does not match!';
284285
elif [[ -n "${sha256sum_bin}" && -x "${sha256sum_bin}" ]]; then
285286
(
286287
cd "${download_tmp}";
287288
"${sha256sum_bin}" \
288289
-c <(grep -F "${tarball_name}" "${shasums_name}")
289-
) || log 'error' 'SHA256 hash does not match!';
290+
) && log 'info' 'SHA256 hash matched!' \
291+
|| log 'error' 'SHA256 hash does not match!';
290292
else
291293
# Lack of shasum deserves a proper warning
292294
log 'warn' 'No shasum tool available. Skipping SHA256 hash validation';

0 commit comments

Comments
 (0)