diff --git a/libexec/tfenv-install b/libexec/tfenv-install index 4f471ec..a91da3b 100755 --- a/libexec/tfenv-install +++ b/libexec/tfenv-install @@ -105,6 +105,7 @@ esac; keybase_bin="$(command -v keybase 2>/dev/null)"; shasum_bin="$(command -v shasum 2>/dev/null)"; +sha256sum_bin="$(command -v sha256sum 2>/dev/null)"; TFENV_REMOTE="${TFENV_REMOTE:-https://releases.hashicorp.com}"; version_url="${TFENV_REMOTE}/terraform/${version}"; @@ -229,6 +230,13 @@ if [[ -n "${shasum_bin}" && -x "${shasum_bin}" ]]; then -c <(grep -F "${tarball_name}" "${shasums_name}") \ || log 'error' 'SHA256 hash does not match!'; ); +elif [[ -n "${sha256sum_bin}" && -x "${sha256sum_bin}" ]]; then + ( + cd "${download_tmp}"; + "${sha256sum_bin}" \ + -c <(grep -F "${tarball_name}" "${shasums_name}") \ + || log 'error' 'SHA256 hash does not match!'; + ); else # Lack of shasum deserves a proper warning log 'warn' 'No shasum tool available. Skipping SHA256 hash validation';