build-static.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. #
  3. # Builds the netdata-vX.Y.Z-xxxx.gz.run (static x86_64) artifact.
  4. set -e
  5. # shellcheck source=.github/scripts/functions.sh
  6. . "$(dirname "$0")/functions.sh"
  7. BUILDARCH="${1}"
  8. NAME="${NAME:-netdata}"
  9. VERSION="${VERSION:-"$(git describe)"}"
  10. BASENAME="$NAME-$BUILDARCH-$VERSION"
  11. prepare_build() {
  12. progress "Preparing build"
  13. (
  14. test -d artifacts || mkdir -p artifacts
  15. ) >&2
  16. }
  17. build_static() {
  18. progress "Building static ${BUILDARCH}"
  19. (
  20. EXTRA_INSTALL_FLAGS="${EXTRA_INSTALL_FLAGS}" USER="" ./packaging/makeself/build-static.sh "${BUILDARCH}"
  21. ) >&2
  22. }
  23. prepare_assets() {
  24. progress "Preparing assets"
  25. (
  26. cp packaging/version artifacts/latest-version.txt
  27. cd artifacts || exit 1
  28. ln -s "${BASENAME}.gz.run" "netdata-${BUILDARCH}-latest.gz.run"
  29. if [ "${BUILDARCH}" = "x86_64" ]; then
  30. ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
  31. fi
  32. ) >&2
  33. }
  34. steps="prepare_build build_static"
  35. steps="$steps prepare_assets"
  36. _main() {
  37. for step in $steps; do
  38. if ! run "$step"; then
  39. if [ -t 1 ]; then
  40. debug
  41. else
  42. fail "Build failed"
  43. fi
  44. fi
  45. done
  46. echo "🎉 All Done!"
  47. }
  48. if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then
  49. _main "$@"
  50. fi