70-netdata-git.install.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. # shellcheck source=./packaging/makeself/functions.sh
  4. . "${NETDATA_MAKESELF_PATH}"/functions.sh "${@}" || exit 1
  5. cd "${NETDATA_SOURCE_PATH}" || exit 1
  6. if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
  7. export CFLAGS="-static -O3"
  8. else
  9. export CFLAGS="-static -O1 -ggdb -Wall -Wextra -Wformat-signedness -fstack-protector-all -D_FORTIFY_SOURCE=2 -DNETDATA_INTERNAL_CHECKS=1"
  10. fi
  11. # We export this to 'yes', installer sets this to .environment.
  12. # The updater consumes this one, so that it can tell whether it should update a static install or a non-static one
  13. export IS_NETDATA_STATIC_BINARY="yes"
  14. # Set eBPF LIBC to "static" to bundle the `-static` variant of the kernel-collector
  15. export EBPF_LIBC="static"
  16. export PKG_CONFIG_PATH="/opnessl/lib/pkgconfig"
  17. run ./netdata-installer.sh \
  18. --install "${NETDATA_INSTALL_PARENT}" \
  19. --dont-wait \
  20. --dont-start-it
  21. # Remove the netdata.conf file from the tree. It has hard-coded sensible defaults builtin.
  22. run rm -f "${NETDATA_INSTALL_PATH}/etc/netdata/netdata.conf"
  23. # Ensure the netdata binary is in fact statically linked
  24. if run readelf -l "${NETDATA_INSTALL_PATH}"/bin/netdata | grep 'INTERP'; then
  25. printf >&2 "Ooops. %s is not a statically linked binary!\n" "${NETDATA_INSTALL_PATH}"/bin/netdata
  26. ldd "${NETDATA_INSTALL_PATH}"/bin/netdata
  27. exit 1
  28. fi
  29. if [ ${NETDATA_BUILD_WITH_DEBUG} -eq 0 ]; then
  30. run strip "${NETDATA_INSTALL_PATH}"/bin/netdata
  31. run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/apps.plugin
  32. run strip "${NETDATA_INSTALL_PATH}"/usr/libexec/netdata/plugins.d/cgroup-network
  33. fi