mkspec.sh 478 B

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. TARGET="$1"
  3. GITCOMMIT="$(git rev-parse HEAD)"
  4. GITDESC="$(git describe --tags HEAD)"
  5. GITTAG="$(echo $GITDESC | cut -f1 -d-)"
  6. GITTAG="${GITTAG#v}"
  7. if [ "v$GITTAG" = "$GITDESC" ]; then
  8. ISSNAP=0
  9. GITCOUNT=0
  10. else
  11. ISSNAP=1
  12. GITCOUNT="$(echo $GITDESC | cut -f2 -d-)"
  13. fi
  14. sed -e "s/@ISSNAP@/${ISSNAP}/" \
  15. -e "s/@VERSION@/${GITTAG}/" \
  16. -e "s/@SNAPCOMMIT@/${GITCOMMIT}/" \
  17. -e "s/@SNAPCOUNT@/${GITCOUNT}/" \
  18. ${TARGET}.spec.in > ${TARGET}.spec