Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | TAG=$(git describe | cut -d- -f1 | sed -e 's/^v//') |
| 4 | ADD=$(git describe | cut -s -d- -f2) |
| 5 | CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4) |
| 6 | |
| 7 | if [ "$1" = "rpm-version" ]; then |
| 8 | echo ${TAG} |
| 9 | exit |
| 10 | fi |
| 11 | |
| 12 | if [ "$1" = "rpm-release" ]; then |
| 13 | [ -z "${ADD}" ] && echo release && exit |
Dave Barach | 0e5e3c3 | 2016-01-25 08:28:22 -0500 | [diff] [blame] | 14 | CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4 | sed 's/-/_/') |
Ed Warnicke | cb9cada | 2015-12-08 15:45:58 -0700 | [diff] [blame] | 15 | echo ${ADD}~${CMT} |
| 16 | exit |
| 17 | fi |
| 18 | |
| 19 | if [ -n "${ADD}" ]; then |
| 20 | echo ${TAG}-${ADD}~${CMT} |
| 21 | else |
| 22 | echo ${TAG} |
| 23 | fi |