Skip to content

Commit

Permalink
Merge branch 'master' into download-latest-version-if-regex-is-used
Browse files Browse the repository at this point in the history
  • Loading branch information
Zordrak authored Aug 14, 2021
2 parents 675689b + 31b8ed6 commit 131e25c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libexec/tfenv-install
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fi;
for dir in libexec bin; do
case ":${PATH}:" in
*:${TFENV_ROOT}/${dir}:*) log 'debug' "\$PATH already contains '${TFENV_ROOT}/${dir}', not adding it again";;
*)
*)
log 'debug' "\$PATH does not contain '${TFENV_ROOT}/${dir}', prepending and exporting it now";
export PATH="${TFENV_ROOT}/${dir}:${PATH}";
;;
Expand Down Expand Up @@ -134,7 +134,12 @@ shasums_sig="${shasums_name}${shasums_signing_key_postfix}.sig";
log 'info' "Installing Terraform v${version}";

# Create a local temporary directory for downloads
download_tmp="$(mktemp -d tfenv_download.XXXXXX)" || log 'error' "Unable to create temporary download directory in $(pwd)";
tmpdir_arg="--tmpdir"
if [[ $(uname) == 'Darwin' ]]; then
# MacOS uses an old version of `mktemp` which only supports the deprecated `-t` option
tmpdir_arg="-t"
fi
download_tmp="$(mktemp -d ${tmpdir_arg} tfenv_download.XXXXXX)" || log 'error' "Unable to create temporary download directory in $(pwd)";
# Clean it up in case of error
trap "rm -rf ${download_tmp}" EXIT;

Expand Down

0 comments on commit 131e25c

Please sign in to comment.