diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2022-02-25 17:10:35 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-25 17:10:35 +0000 |
commit | d787fc15a4902f4ce10b2afd2516a5babef64c01 (patch) | |
tree | 92e57de666030c1ce3fdeeda07bbe897544351f5 /netdata-installer.sh | |
parent | e1b8c76cbf02a58fdbfa2fc99485152af66b2fc9 (diff) |
eBPF installation fixes (#12242)
Diffstat (limited to 'netdata-installer.sh')
-rwxr-xr-x | netdata-installer.sh | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/netdata-installer.sh b/netdata-installer.sh index 3f5c01e219..13560a91c2 100755 --- a/netdata-installer.sh +++ b/netdata-installer.sh @@ -904,6 +904,37 @@ get_kernel_version() { printf "%03d%03d%03d" "${maj}" "${min}" "${patch}" } +detect_libc() { + libc= + if ldd --version 2>&1 | grep -q -i glibc; then + echo >&2 " Detected GLIBC" + libc="glibc" + elif ldd --version 2>&1 | grep -q -i 'gnu libc'; then + echo >&2 " Detected GLIBC" + libc="glibc" + elif ldd --version 2>&1 | grep -q -i musl; then + echo >&2 " Detected musl" + libc="musl" + else + ls_path=$(command -v ls) + if [ -n "${ls_path}" ] ; then + cmd=$(ldd "$ls_path" | grep -w libc | cut -d" " -f 3) + if bash -c "${cmd}" 2>&1 | grep -q -i "GNU C Library"; then + echo >&2 " Detected GLIBC" + libc="glibc" + fi + fi + fi + + if [ -z "$libc" ]; then + echo >&2 " ERROR: Cannot detect a supported libc on your system!" + return 1 + fi + + echo "${libc}" + return 0 +} + rename_libbpf_packaging() { if [ "$(get_kernel_version)" -ge "004014000" ]; then cp packaging/current_libbpf.checksums packaging/libbpf.checksums @@ -943,6 +974,14 @@ bundle_libbpf() { return 0 fi + # When libc is not detected, we do not have necessity to compile libbpf and we should not do download of eBPF programs + libc="${EBPF_LIBC:-"$(detect_libc)"}" + if [ -z "$libc" ]; then + NETDATA_DISABLE_EBPF=1 + NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--disable-ebpf)}" | sed 's/$/ --disable-ebpf/g')" + return 0 + fi + [ -n "${GITHUB_ACTIONS}" ] && echo "::group::Bundling libbpf." rename_libbpf_packaging @@ -1555,25 +1594,6 @@ install_go() { install_go -detect_libc() { - libc= - if ldd --version 2>&1 | grep -q -i glibc; then - echo >&2 " Detected GLIBC" - libc="glibc" - elif ldd --version 2>&1 | grep -q -i 'gnu libc'; then - echo >&2 " Detected GLIBC" - libc="glibc" - elif ldd --version 2>&1 | grep -q -i musl; then - echo >&2 " Detected musl" - libc="musl" - else - echo >&2 " ERROR: Cannot detect a supported libc on your system!" - return 1 - fi - echo "${libc}" - return 0 -} - should_install_ebpf() { if [ "${NETDATA_DISABLE_EBPF:=0}" -eq 1 ]; then run_failed "eBPF explicitly disabled." |