bundle-ebpf.sh 822 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. SRCDIR="${1}"
  3. PLUGINDIR="${2}"
  4. FORCE="${3}"
  5. EBPF_VERSION="$(cat "${SRCDIR}/packaging/ebpf.version")"
  6. EBPF_TARBALL="netdata-kernel-collector-glibc-${EBPF_VERSION}.tar.xz"
  7. if [ -x "${PLUGINDIR}/ebpf.plugin" ] || [ "${FORCE}" = "force" ]; then
  8. mkdir -p "${SRCDIR}/tmp/ebpf"
  9. curl -sSL --connect-timeout 10 --retry 3 "https://github.com/netdata/kernel-collector/releases/download/${EBPF_VERSION}/${EBPF_TARBALL}" > "${EBPF_TARBALL}" || exit 1
  10. grep "${EBPF_TARBALL}" "${SRCDIR}/packaging/ebpf.checksums" | sha256sum -c - || exit 1
  11. tar -xvaf "${EBPF_TARBALL}" -C "${SRCDIR}/tmp/ebpf" || exit 1
  12. if [ ! -d "${PLUGINDIR}/ebpf.d" ];then
  13. mkdir "${PLUGINDIR}/ebpf.d"
  14. fi
  15. # shellcheck disable=SC2046
  16. cp -r $(find "${SRCDIR}/tmp/ebpf" -mindepth 1 -maxdepth 1) "${PLUGINDIR}/ebpf.d"
  17. fi