version 473 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
  3. DIRTY="-dirty"
  4. fi
  5. COMMIT=$(git rev-parse --short HEAD)
  6. GIT_TAG=$(git tag -l --contains HEAD | head -n 1)
  7. if [ -z "$VERSION" ]; then
  8. if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
  9. VERSION=$GIT_TAG
  10. else
  11. VERSION="${COMMIT}${DIRTY}"
  12. fi
  13. fi
  14. export VERSION COMMIT
  15. # Suffix
  16. export SUFFIX=""
  17. if [ -n "${ARCH}" ] && [ "${ARCH}" != "amd64" ]; then
  18. SUFFIX="_${ARCH}"
  19. fi