build-static.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. test -d artifacts || mkdir -p artifacts
  13. }
  14. build_static() {
  15. EXTRA_INSTALL_FLAGS="${EXTRA_INSTALL_FLAGS}" USER="" ./packaging/makeself/build-static.sh "${BUILDARCH}"
  16. }
  17. prepare_assets() {
  18. cp packaging/version artifacts/latest-version.txt
  19. cd artifacts || exit 1
  20. ln -s "${BASENAME}.gz.run" "netdata-${BUILDARCH}-latest.gz.run"
  21. if [ "${BUILDARCH}" = "x86_64" ]; then
  22. ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
  23. fi
  24. }
  25. steps="prepare_build build_static"
  26. steps="$steps prepare_assets"
  27. _main() {
  28. for step in $steps; do
  29. if ! run "$step"; then
  30. if [ -t 1 ]; then
  31. debug
  32. else
  33. fail "Build failed"
  34. fi
  35. fi
  36. done
  37. echo "🎉 All Done!"
  38. }
  39. if [ -n "$0" ] && [ x"$0" != x"-bash" ]; then
  40. _main "$@"
  41. fi