Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added MacOS ARM M1 support, only for v2 #16

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,34 @@ install_version() {
local url="https://awscli.amazonaws.com/AWSCLIV2-${version}.pkg"

curl "${CURL_OPTS[@]}" -o "${release_file}" -C - "${url}" || fail "Could not download ${url}"

rm -rf ./AWSCLIV2
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>choiceAttribute</key>
<string>customLocation</string>
<key>attributeSetting</key>
<string>${install_path}</string>
<key>choiceIdentifier</key>
<string>default</string>
</dict>
</array>
</plist>
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
rm -rf ./AWSCLIV2
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."
) || (
Expand Down