From 0a3149ae8ad3087878508ea92bcc549d52c0b298 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 28 May 2021 18:43:31 -0300 Subject: [PATCH] Do not exit when --static is called on non-Linux [skip ci] (#871) While creating [this gist](https://gist.github.com/thiagokokada/115b2588ff65a48d54b8832488801c92) I realized that exiting if the --static flag is passed on non-Linux systems just make more difficult to handle those cases. Instead, let's just print a message informing the user of their mistake, and keep running the script with the correct filename. --- install | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/install b/install index 2ab2d3ea..e21e5a11 100755 --- a/install +++ b/install @@ -78,14 +78,14 @@ if [[ "$version" == "" ]]; then fi case "$(uname -s)" in - Linux*) platform=linux;; - Darwin*) platform=macos;; + Linux*) platform=linux;; + Darwin*) platform=macos;; esac case "$(uname -m)" in - aarch64) arch=aarch64;; + aarch64) arch=aarch64;; + *) arch=amd64;; esac -arch="${arch:-amd64}" # Ugly ugly conversion of version to a comparable number IFS='.' read -ra VER <<< "$version" @@ -99,15 +99,16 @@ else util="$(which tar) -zxf" fi -if [[ "$static_binary" == "true" ]]; then - if [[ "$platform" != "linux" ]]; then - >&2 echo "Static binaries are only available in Linux platform!" - exit 1 - fi - filename="babashka-$version-$platform-$arch-static."$ext -else - filename="babashka-$version-$platform-$arch."$ext -fi +case "$platform-$static_binary" in + linux-true) filename="babashka-$version-$platform-$arch-static."$ext + ;; + *-true) >&2 echo "Static binaries are only available in Linux platform! Using the non-static one..." + filename="babashka-$version-$platform-$arch."$ext + ;; + *) filename="babashka-$version-$platform-$arch."$ext + ;; +esac + download_url="https://github.com/babashka/babashka/releases/download/v$version/$filename" # Running this part in a subshell so when it finishes we go back to the previous directory