scripts/version
raw| 1 | #!/bin/sh |
| 2 | # Distro packagers may set the LOCALVER variable to add their distribution to |
| 3 | # the version, e.g. 1.0-alpine. |
| 4 | VERSION="${VERSION:-0.26.0.1}" |
| 5 | |
| 6 | ver=$(git describe 2>/dev/null) |
| 7 | # shellcheck disable=SC2181 |
| 8 | if [ $? -ne 0 ]; then |
| 9 | ver="dev+$(git log -1 --format='%h' 2>/dev/null)" |
| 10 | if [ $? -ne 0 ]; then |
| 11 | # git presumed unavailable |
| 12 | ver="$VERSION" |
| 13 | fi |
| 14 | fi |
| 15 | |
| 16 | printf -- '%s' "$ver${LOCALVER:+"-$LOCALVER"}" |