diff options
author | Valery Piashchynski <[email protected]> | 2023-01-13 14:23:47 +0100 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2023-01-13 14:23:47 +0100 |
commit | 66719ad1a0c9112af67d43ba5e2142357301f790 (patch) | |
tree | c6b37f45120ea0b7daa058639e0a96b508844631 /download-latest.sh | |
parent | f8d6b01ad00240c1810982ce217b106821a5907f (diff) |
fix alpine<->general linux detection
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'download-latest.sh')
-rw-r--r-- | download-latest.sh | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/download-latest.sh b/download-latest.sh index 37097920..15e80333 100644 --- a/download-latest.sh +++ b/download-latest.sh @@ -47,18 +47,19 @@ get_latest() { return 0 } +# 0 -> not alpine +# >0 -> alpine isAlpine() { - return "$(cat "/etc/os-release" | grep "NAME=" | grep -ic "Alpine")" + if [ "$(cat "/etc/os-release" | grep "NAME=" | grep -ic "Alpine")" ]; then + return 1 + fi + + return 0 } # Gets the OS by setting the $os variable. # Returns 0 in case of success, 1 otherwise. get_os() { - if isAlpine; then - os="unknown-musl" - return 0 - fi - os_name=$(uname -s) case "$os_name" in 'Darwin') @@ -66,6 +67,10 @@ get_os() { ;; 'Linux') os='linux' + if isAlpine; then + os="unknown-musl" + fi + ;; 'MINGW'*) os='windows' @@ -77,14 +82,15 @@ get_os() { return 0 } - # Gets the architecture by setting the $archi variable. # Returns 0 in case of success, 1 otherwise. get_archi() { architecture=$(uname -m) - case "$architecture" in ('x86_64' | 'amd64') - archi='amd64';;'arm64') + case "$architecture" in 'x86_64' | 'amd64') + archi='amd64' + ;; + 'arm64') # macOS M1/M2 if [ $os = 'macos' ]; then @@ -101,11 +107,6 @@ get_archi() { } get_compress() { - if isAlpine; then - compress="zip" - return 0 - fi - os_name=$(uname -s) case "$os_name" in 'Darwin') @@ -113,6 +114,9 @@ get_compress() { ;; 'Linux') compress='tar.gz' + if isAlpine; then + compress="zip" + fi ;; 'MINGW'*) compress='zip' |