From b3be99f06bdf73448ebfc616caca8c59242eb78a Mon Sep 17 00:00:00 2001 From: Antonio Fragola Date: Thu, 12 May 2022 10:34:07 +0200 Subject: [PATCH] added MacOS ARM M1 support, only for v2 --- lib/utils.bash | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/utils.bash b/lib/utils.bash index 635be90..b89401c 100755 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -67,13 +67,33 @@ install_version() { local url="https://awscli.amazonaws.com/AWSCLIV2-${version}.pkg" curl "${CURL_OPTS[@]}" -o "${release_file}" -C - "${url}" || fail "Could not download ${url}" - - pkgutil --expand-full "${release_file}" ./AWSCLIV2 || fail "Could not extract ${release_file}" - mv ./AWSCLIV2/aws-cli.pkg/Payload/aws-cli "${install_path}" + if [[ "${os_arch}" == "arm64" ]]; then + read -rd '' choices << EOF + + + + + + choiceAttribute + customLocation + attributeSetting + ${install_path} + choiceIdentifier + default + + + +EOF + echo "$choices" > ${install_path}/choices.xml + installer -pkg $release_file -target CurrentUserHomeDirectory -applyChoiceChangesXML ${install_path}/choices.xml || fail "Could not extract ${release_file}" + else + pkgutil --expand-full "${release_file}" ./AWSCLIV2 || fail "Could not extract ${release_file}" + mv ./AWSCLIV2/aws-cli.pkg/Payload/aws-cli "${install_path}" + fi mkdir "${install_path}/bin" ln -s "${install_path}/aws-cli/aws" "${install_path}/bin/aws" ln -s "${install_path}/aws-cli/aws_completer" "${install_path}/bin/aws_completer" - rm -rf "${release_file}" ./AWSCLIV2 + rm -rf "${release_file}" ./AWSCLIV2 "${install_path}"/choices.xml test -x "${test_path}" || fail "Expected ${test_path} to be executable." ) || (