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

Detect and download arm64 architecture #27

Merged
merged 2 commits into from
Nov 28, 2021
Merged
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
18 changes: 14 additions & 4 deletions scripts/install-ch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,20 @@ function add_to_path() {
precheck

version=$(get_latest_release $repository)
architecture=$(uname -m)
operating_system=$(uname)
zip_filename=
if [ "$(uname)" = "Linux" ]; then
zip_filename="ch-linux-amd64.zip"
if [ "$operating_system" = "Linux" ] && { [ "$architecture" = "x86_64" ] || [ "$architecture" = "x86-64" ]; } then
zip_filename="ch-linux-amd64.zip"
elif [ "$operating_system" = "Linux" ] && [ "$architecture" = "aarch64" ]; then
# aarch64 is supposedly the same as arm64 and containerd treats them the
# same so we should be good
# https://stackoverflow.com/a/47274698/4676641
zip_filename="ch-linux-arm64.zip"
elif [ "$operating_system" = "Darwin" ] && [ "$architecture" = "arm64" ]; then
zip_filename="ch-darwin-arm64.zip"
else
zip_filename="ch-darwin-amd64.zip"
zip_filename="ch-darwin-amd64.zip"
fi

release_url=$(get_release_url "$repository" "$version" "$zip_filename")
Expand All @@ -97,4 +106,5 @@ if ! echo "$PATH" | grep ${zip_filename%.*} > /dev/null ; then
add_to_path "$HOME/${zip_filename%.*}"
fi

echo "Done! Try using ch with: ch --help"
echo "Done! Try using ch with: ch --help"