My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

generate_version 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/usr/bin/env bash
  2. #
  3. # generate_version
  4. #
  5. # Make a _Version.h file
  6. #
  7. DIR="${1}"
  8. BUILDATE=$(date '+%s')
  9. DISTDATE=$(date '+%Y-%m-%d %H:%M')
  10. BRANCH=$(git -C "${DIR}" symbolic-ref -q --short HEAD)
  11. VERSION=$(git -C "${DIR}" describe --tags --first-parent 2>/dev/null)
  12. [ -z "${BRANCH}" ] && BRANCH=$(echo "${TRAVIS_BRANCH}")
  13. [ -z "${VERSION}" ] && VERSION=$(git -C "${DIR}" describe --tags --first-parent --always 2>/dev/null)
  14. SHORT_BUILD_VERSION=$(echo "${BRANCH}")
  15. DETAILED_BUILD_VERSION=$(echo "${BRANCH}-${VERSION}")
  16. # Gets some misc options from their defaults
  17. DEFAULT_MACHINE_UUID=$(awk -F'"' \
  18. '/#define DEFAULT_MACHINE_UUID/{ print $2 }' < "${DIR}/Version.h")
  19. MACHINE_NAME=$(awk -F'"' \
  20. '/#define MACHINE_NAME/{ print $2 }' < "${DIR}/Version.h")
  21. PROTOCOL_VERSION=$(awk -F'"' \
  22. '/#define PROTOCOL_VERSION/{ print $2 }' < "${DIR}/Version.h")
  23. SOURCE_CODE_URL=$(awk -F'"' \
  24. '/#define SOURCE_CODE_URL/{ print $2 }' < "${DIR}/Version.h")
  25. WEBSITE_URL=$(awk -F'"' \
  26. '/#define WEBSITE_URL/{ print $2 }' < "${DIR}/Version.h")
  27. cat > "${DIR}/_Version.h" <<EOF
  28. /**
  29. * THIS FILE IS AUTOMATICALLY GENERATED DO NOT MANUALLY EDIT IT.
  30. * IT DOES NOT GET COMMITTED TO THE REPOSITORY.
  31. *
  32. * Branch: ${BRANCH}
  33. * Version: ${VERSION}
  34. */
  35. #define BUILD_UNIX_DATETIME "${BUILDATE}"
  36. #define STRING_DISTRIBUTION_DATE "${DISTDATE}"
  37. #define SHORT_BUILD_VERSION "${SHORT_BUILD_VERSION}"
  38. #define DETAILED_BUILD_VERSION "${DETAILED_BUILD_VERSION}"
  39. #define PROTOCOL_VERSION "${PROTOCOL_VERSION}"
  40. #define MACHINE_NAME "${MACHINE_NAME}"
  41. #define SOURCE_CODE_URL "${SOURCE_CODE_URL}"
  42. #define DEFAULT_MACHINE_UUID "${DEFAULT_MACHINE_UUID}"
  43. #define WEBSITE_URL "${WEBSITE_URL}"
  44. EOF