fix detect_libc in installer (#17880)
Ilya Mashchenko committed
Jun 13, 2024 at 23:20 UTC
af11bfa7dc8ef75360754ac6ae680b2f31116c63
1 file changed
+27
-27
netdata-installer.sh
+27
-27
@@ -583,6 +583,33 @@ build_fluentbit() {
583
cd - > /dev/null || return 1
584
}
585
586
+detect_libc() {
587
+ libc=
588
+ if ldd --version 2>&1 | grep -q -i glibc; then
589
+ echo >&2 " Detected GLIBC"
590
+ libc="glibc"
591
+ elif ldd --version 2>&1 | grep -q -i 'gnu libc'; then
592
+ echo >&2 " Detected GLIBC"
593
+ libc="glibc"
594
+ elif ldd --version 2>&1 | grep -q -i musl; then
595
+ echo >&2 " Detected musl"
596
+ libc="musl"
597
+ else
598
+ cmd=$(ldd /bin/sh | grep -w libc | cut -d" " -f 3)
599
+ if bash -c "${cmd}" 2>&1 | grep -q -i "GNU C Library"; then
600
+ echo >&2 " Detected GLIBC"
601
+ libc="glibc"
602
+ fi
603
+ fi
604
+
605
+ if [ -z "$libc" ]; then
606
+ warning "Cannot detect a supported libc on your system, eBPF support will be disabled."
607
+ return 1
608
+ fi
609
+
610
+ echo "${libc}"
611
+}
612
+
613
bundle_fluentbit() {
614
progress "Prepare Fluent-Bit"
615
@@ -1055,33 +1082,6 @@ fi
1082
1083
[ -n "${GITHUB_ACTIONS}" ] && echo "::endgroup::"
1084
1058
-detect_libc() {
1059
- libc=
1060
- if ldd --version 2>&1 | grep -q -i glibc; then
1061
- echo >&2 " Detected GLIBC"
1062
- libc="glibc"
1063
- elif ldd --version 2>&1 | grep -q -i 'gnu libc'; then
1064
- echo >&2 " Detected GLIBC"
1065
- libc="glibc"
1066
- elif ldd --version 2>&1 | grep -q -i musl; then
1067
- echo >&2 " Detected musl"
1068
- libc="musl"
1069
- else
1070
- cmd=$(ldd /bin/sh | grep -w libc | cut -d" " -f 3)
1071
- if bash -c "${cmd}" 2>&1 | grep -q -i "GNU C Library"; then
1072
- echo >&2 " Detected GLIBC"
1073
- libc="glibc"
1074
- fi
1075
- fi
1076
-
1077
- if [ -z "$libc" ]; then
1078
- warning "Cannot detect a supported libc on your system, eBPF support will be disabled."
1079
- return 1
1080
- fi
1081
-
1082
- echo "${libc}"
1083
-}
1084
-
1085
should_install_fluentbit() {
1086
if [ "$(uname -s)" = "Darwin" ]; then
1087
return 1