From 3924ad76faf24f83270e6a07d5d143b839cec05e Mon Sep 17 00:00:00 2001 From: Chris Colborne Date: Tue, 7 Nov 2023 12:23:20 +1000 Subject: [PATCH] Refactor release_name function to be more resilient detecting architecture on macOS [#350] --- install/install.sh | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/install/install.sh b/install/install.sh index 0ffb0db0..b66a55b8 100755 --- a/install/install.sh +++ b/install/install.sh @@ -26,20 +26,15 @@ release_name() { case "${os_name}" in Darwin) name="${name}-osx" - arch="$(echo $os_info | rev | cut -d ' ' -f1 | rev)" - - case "${arch}" in - arm64) - name="${name}-arm64" - ;; - x86_64) - name="${name}-x64" - ;; - *) - error "Unsupported architecture '${arch}', unable to download a release" - exit 1 - ;; - esac + # check if os_info contains arm64 or x86_64 + if echo $os_info | grep -q arm64; then + name="${name}-arm64" + elif echo $os_info | grep -q x86_64; then + name="${name}-x64" + else + error "Unsupported architecture '${arch}', unable to download a release" + exit 1 + fi ;; *) error "Unsupported OS '${os_name}', unable to download a release"