build.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-3.0-or-later
  3. # -----------------------------------------------------------------------------
  4. # parse command line arguments
  5. set -e
  6. export NETDATA_BUILD_WITH_DEBUG=0
  7. while [ -n "${1}" ]; do
  8. case "${1}" in
  9. debug)
  10. export NETDATA_BUILD_WITH_DEBUG=1
  11. ;;
  12. *) ;;
  13. esac
  14. shift
  15. done
  16. # -----------------------------------------------------------------------------
  17. # First run install-alpine-packages.sh under alpine linux to install
  18. # the required packages. build-x86_64-static.sh will do this for you
  19. # using docker.
  20. mkdir -p /usr/src
  21. cp -va /netdata /usr/src/netdata
  22. chown -R root:root /usr/src/netdata
  23. cd /usr/src/netdata/packaging/makeself || exit 1
  24. cat >&2 << EOF
  25. This program will create a self-extracting shell package containing
  26. a statically linked netdata, able to run on any 64bit Linux system,
  27. without any dependencies from the target system.
  28. It can be used to have netdata running in no-time, or in cases the
  29. target Linux system cannot compile netdata.
  30. EOF
  31. if [ ! -d tmp ]; then
  32. mkdir tmp || exit 1
  33. else
  34. rm -rf tmp/*
  35. fi
  36. if [ -z "${GITHUB_ACTIONS}" ]; then
  37. export GITHUB_ACTIONS=false
  38. fi
  39. if ! ./run-all-jobs.sh "$@"; then
  40. printf >&2 "Build failed."
  41. exit 1
  42. fi
  43. mkdir -p /netdata/artifacts
  44. cp -va /usr/src/netdata/artifacts/* /netdata/artifacts/
  45. chown -R "$(stat -c '%u:%g' /netdata)" /netdata/artifacts/