diff options
author | Valery Piashchynski <[email protected]> | 2023-01-14 01:01:11 +0100 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2023-01-14 01:01:11 +0100 |
commit | 7131dba2d5bc48062764a596ca9972c27281d265 (patch) | |
tree | 6e02b07dbd860efde7446e542f3d541fd8d84810 /download-latest.sh | |
parent | 266ff1f5e9b3ae1995e4b51456928e3b16ea8222 (diff) |
rework `get_arch` method
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'download-latest.sh')
-rw-r--r-- | download-latest.sh | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/download-latest.sh b/download-latest.sh index d2a1a445..f32061ba 100644 --- a/download-latest.sh +++ b/download-latest.sh @@ -81,25 +81,28 @@ get_os() { return 0 } -# Gets the architecture by setting the $archi variable. +# Gets the architecture by setting the $arch variable. # Returns 0 in case of success, 1 otherwise. -get_archi() { +get_arch() { architecture=$(uname -m) - case "$architecture" in 'x86_64' | 'amd64') - archi='amd64' + # case 1 + case "$architecture" in + 'x86_64' | 'amd64') + arch='amd64' ;; - 'arm64') - # macOS M1/M2 - if [ $os = 'darwin' ]; then - archi='arm64' - fi + # case 2 + 'arm64') + arch='arm64' ;; + + # all other *) return 1 ;; esac + return 0 } @@ -155,8 +158,8 @@ fill_release_variables() { not_available_failure_usage exit 1 fi - # Fill $archi variable. - if ! get_archi; then + # Fill $arch variable. + if ! get_arch; then not_available_failure_usage exit 1 fi @@ -170,8 +173,8 @@ fill_release_variables() { download_binary() { fill_release_variables - echo "Downloading RoadRunner binary $latest for $os, architecture $archi..." - release_file="$PNAME-$latest-$os-$archi.$compress" + echo "Downloading RoadRunner binary $latest for $os, architecture $arch..." + release_file="$PNAME-$latest-$os-$arch.$compress" curl --fail -OL "$GITHUB_REL/$latestV/$release_file" if [ $? -ne 0 ]; then |