version 460 B

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