From a5efd08d7494b72cb30af256411ed8489ef2b941 Mon Sep 17 00:00:00 2001 From: iamhsa Date: Sun, 21 Mar 2021 00:01:59 +0100 Subject: [PATCH 1/2] Install v2 using bundled release on Linux --- README.md | 4 ++-- bin/list-bin-paths | 2 +- lib/utils.bash | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6b78046..980bfc0 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ # Dependencies -- `bash`, `curl`, `tar`: generic POSIX utilities. These should be installed by default on most operating systems. +- `bash`, `curl`, `tar`, `unzip`: generic POSIX utilities. These should be installed by default on most operating systems. -- v1 - Linux/MacOS/Windows || v2 - Linux/Windows +- v1 - Linux/MacOS/Windows || v2 - Windows - `Python 3.7.5+`: This plugin installs awscli from source into a virtualenv on these OS distributions. A currently maintained version of Python is required to do this. # Install diff --git a/bin/list-bin-paths b/bin/list-bin-paths index 9679615..0d52e82 100755 --- a/bin/list-bin-paths +++ b/bin/list-bin-paths @@ -5,7 +5,7 @@ set -euo pipefail MAJOR_VERSION="${ASDF_INSTALL_VERSION:0:1}" OS_DISTRIBUTION="$(uname -s)" -if [[ "${OS_DISTRIBUTION}" == "Darwin" && "${MAJOR_VERSION}" == "2" ]]; then +if [[ ( "${OS_DISTRIBUTION}" == "Darwin" || "${OS_DISTRIBUTION}" == "Linux" ) && "${MAJOR_VERSION}" == "2" ]]; then echo "bin" else echo "venv/bin" diff --git a/lib/utils.bash b/lib/utils.bash index d8897bd..828117a 100755 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -70,6 +70,23 @@ install_version() { ln -s "${install_path}/aws-cli/aws_completer" "${install_path}/bin/aws_completer" rm -rf "${release_file}" ./AWSCLIV2 + test -x "${test_path}" || fail "Expected ${test_path} to be executable." + ) || ( + rm -rf "${install_path}" + fail "An error ocurred while installing awscli ${version}." + ) + elif [[ "${os_distribution}" == "Linux" && "${major_version}" == "2" ]]; then + ( + local release_file="${install_path}/awscli-${version}.zip" + local url="https://awscli.amazonaws.com/awscli-exe-linux-x86_64-${version}.zip" + + curl "${CURL_OPTS[@]}" -o "${release_file}" -C - "${url}" || fail "Could not download ${url}" + + unzip -q ${release_file} -d ./AWSCLIV2 || fail "Could not extract ${release_file}" + mkdir "${install_path}/bin" + ./AWSCLIV2/aws/install -i "${install_path}" -b "${install_path}/bin" + rm -rf "${release_file}" ./AWSCLIV2 + test -x "${test_path}" || fail "Expected ${test_path} to be executable." ) || ( rm -rf "${install_path}" From 743ff88072ce0da536f0438ab8daf0efd3818fd1 Mon Sep 17 00:00:00 2001 From: iamhsa Date: Sun, 21 Mar 2021 00:30:59 +0100 Subject: [PATCH 2/2] shmt fix --- bin/list-bin-paths | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/list-bin-paths b/bin/list-bin-paths index 0d52e82..3234197 100755 --- a/bin/list-bin-paths +++ b/bin/list-bin-paths @@ -5,7 +5,7 @@ set -euo pipefail MAJOR_VERSION="${ASDF_INSTALL_VERSION:0:1}" OS_DISTRIBUTION="$(uname -s)" -if [[ ( "${OS_DISTRIBUTION}" == "Darwin" || "${OS_DISTRIBUTION}" == "Linux" ) && "${MAJOR_VERSION}" == "2" ]]; then +if [[ ("${OS_DISTRIBUTION}" == "Darwin" || "${OS_DISTRIBUTION}" == "Linux") && "${MAJOR_VERSION}" == "2" ]]; then echo "bin" else echo "venv/bin"