From 8311a7e031a314f2812691651a6762dfdaaf4dda Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Thu, 1 Feb 2024 21:34:20 +0100 Subject: [PATCH 1/5] issue 4379 adapt the script to terminate on error in case the system is using bionic or MUSL --- download-latest.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/download-latest.sh b/download-latest.sh index c533d6616..ae7a302e4 100644 --- a/download-latest.sh +++ b/download-latest.sh @@ -65,6 +65,21 @@ get_os() { return 0 } +# Gets the C lib the system is using by setting the $c_lib variable. +# Returns 0 in case of success, 1 otherwise. +get_C_library(){ + if ldd --version | grep -i glibc;then + c_lib='glibc' + elif ldd --version | grep -i musl;then + c_library_failure_usage + elif ldd --version | grep -i bionic; then + c_library_failure_usage + else + return 1 + fi + return 0 +} + # Gets the architecture by setting the $archi variable. # Returns 0 in case of success, 1 otherwise. get_archi() { @@ -106,6 +121,12 @@ not_available_failure_usage() { echo 'Follow the steps at the page ("Source" tab): https://www.meilisearch.com/docs/learn/getting_started/installation' } +c_library_failure_usage() { + printf "$RED%s\n$DEFAULT" 'ERROR: Meilisearch binary is not compatible with the current C library your system is using.' + echo '' + echo 'Meilisearch is designed to work with certain C libraries, such as glibc. Ensure that your system uses a compatible C library environment.' +} + fetch_release_failure_usage() { echo '' printf "$RED%s\n$DEFAULT" 'ERROR: Impossible to get the latest stable version of Meilisearch.' @@ -134,6 +155,11 @@ fill_release_variables() { not_available_failure_usage exit 1 fi + # Fill $c_lib variable. + if ! get_C_library; then + c_library_failure_usage + fi + } download_binary() { From 6ec0310ceb165f64bfeccab62e7a3076613a80d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20U=2E=20-=20curqui?= Date: Mon, 5 Feb 2024 10:59:54 +0100 Subject: [PATCH 2/5] Update download-latest.sh --- download-latest.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/download-latest.sh b/download-latest.sh index ae7a302e4..049f9b51e 100644 --- a/download-latest.sh +++ b/download-latest.sh @@ -68,9 +68,9 @@ get_os() { # Gets the C lib the system is using by setting the $c_lib variable. # Returns 0 in case of success, 1 otherwise. get_C_library(){ - if ldd --version | grep -i glibc;then + if ldd --version | grep -i glibc; then c_lib='glibc' - elif ldd --version | grep -i musl;then + elif ldd --version | grep -i musl; then c_library_failure_usage elif ldd --version | grep -i bionic; then c_library_failure_usage From 311c2e4e887f055a7ee7f4230cefcac891ff6ac4 Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Mon, 5 Feb 2024 22:32:44 +0100 Subject: [PATCH 3/5] Update download-latest.sh add support for `eglibc` and make error message more understanding --- download-latest.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/download-latest.sh b/download-latest.sh index 049f9b51e..d2e199c8a 100644 --- a/download-latest.sh +++ b/download-latest.sh @@ -70,6 +70,8 @@ get_os() { get_C_library(){ if ldd --version | grep -i glibc; then c_lib='glibc' + elif ldd --version | grep -i eglibc; then + c_lib='eglibc' elif ldd --version | grep -i musl; then c_library_failure_usage elif ldd --version | grep -i bionic; then @@ -122,9 +124,10 @@ not_available_failure_usage() { } c_library_failure_usage() { - printf "$RED%s\n$DEFAULT" 'ERROR: Meilisearch binary is not compatible with the current C library your system is using.' + printf "$RED%s\n$DEFAULT" 'ERROR: Meilisearch is designed to work with certain C libraries, such as glibc. Ensure that your system uses a compatible C library environment.' echo '' - echo 'Meilisearch is designed to work with certain C libraries, such as glibc. Ensure that your system uses a compatible C library environment.' + echo 'However, you can easily compile the binary from the source files or using the docker image' + echo 'Follow the steps at the page ("Source" tab): https://www.meilisearch.com/docs/learn/getting_started/installation#local-installation' } fetch_release_failure_usage() { From 9cd43780dd8f23db7e648f25f26598958b13235c Mon Sep 17 00:00:00 2001 From: Mathias Vandaele Date: Mon, 26 Feb 2024 19:41:32 +0100 Subject: [PATCH 4/5] Correcting the code, was not exiting on error, only linux desktop should go through the test of C lib fixing few error after test --- download-latest.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/download-latest.sh b/download-latest.sh index d2e199c8a..f3e34d18c 100644 --- a/download-latest.sh +++ b/download-latest.sh @@ -68,14 +68,21 @@ get_os() { # Gets the C lib the system is using by setting the $c_lib variable. # Returns 0 in case of success, 1 otherwise. get_C_library(){ - if ldd --version | grep -i glibc; then - c_lib='glibc' - elif ldd --version | grep -i eglibc; then + if [ "$os" != 'linux' ] ; then + return 0 + fi + if ldd --version | grep -qi eglibc; then c_lib='eglibc' - elif ldd --version | grep -i musl; then + return 0 + elif ldd --version | grep -qi glibc; then + c_lib='glibc' + return 0 + elif ldd --version | grep -qi musl; then c_library_failure_usage - elif ldd --version | grep -i bionic; then + return 1 + elif ldd --version | grep -qi bionic; then c_library_failure_usage + return 1 else return 1 fi @@ -161,6 +168,7 @@ fill_release_variables() { # Fill $c_lib variable. if ! get_C_library; then c_library_failure_usage + exit 1 fi } @@ -193,4 +201,4 @@ download_binary() { main() { download_binary } -main +main \ No newline at end of file From bae216cc01c6491945f2d1588835a488ebf2b6b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20U=2E=20-=20curqui?= Date: Thu, 7 Mar 2024 14:32:06 +0100 Subject: [PATCH 5/5] Update download-latest.sh --- download-latest.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download-latest.sh b/download-latest.sh index f3e34d18c..957e05b07 100644 --- a/download-latest.sh +++ b/download-latest.sh @@ -201,4 +201,4 @@ download_binary() { main() { download_binary } -main \ No newline at end of file +main