version.sh 566 B

12345678910111213141516171819202122
  1. #!/bin/sh
  2. v="v9.01"
  3. if [ -d ${GIT_DIR:-.git} ] && tag=`git describe --tags`; then
  4. v="$tag"
  5. # Update the index from working tree first
  6. git update-index --refresh --unmerged > /dev/null
  7. # Does the index show uncommitted changes?
  8. git diff-index --exit-code HEAD > /dev/null || \
  9. v="$v"-dirty
  10. elif [ -n "$RPM_PACKAGE_VERSION" ] && [ -n "$RPM_PACKAGE_RELEASE" ]; then
  11. v="v$RPM_PACKAGE_VERSION-$RPM_PACKAGE_RELEASE"
  12. else # XXX: Equivalent for .deb packages?
  13. v="$v"-unknown
  14. fi
  15. echo "const char openconnect_version_str[] = \"$v\";" > $1
  16. echo "New version: $v"