version 598 B

1234567891011121314151617181920212223242526272829
  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. INITRD=initrd-${VERSION}
  15. export VERSION COMMIT INITRD
  16. # Suffix
  17. export SUFFIX=""
  18. if [ -n "${ARCH}" ] && [ "${ARCH}" != "amd64" ]; then
  19. # TODO: why is this not exported?
  20. SUFFIX="_${ARCH}"
  21. fi
  22. echo " Building ${VERSION} from ${COMMIT} on ${ARCH}"