From f81ad812ef5db2eb348864f36dd0e4c2a3d179b8 Mon Sep 17 00:00:00 2001 From: Reilly Tucker Siemens Date: Wed, 8 Nov 2023 14:29:38 -0800 Subject: [PATCH] Refactor release_name function to be more resilient detecting architecture on macOS [#350] (#354) Co-authored-by: Chris Colborne --- install/install.sh | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/install/install.sh b/install/install.sh index 0ffb0db..b66a55b 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"