mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-25 18:40:19 -04:00
Extend autover to work also without git tags
This commit is contained in:
parent
5ebf6ab186
commit
09897fcdb3
1 changed files with 9 additions and 4 deletions
13
autover.sh
13
autover.sh
|
|
@ -3,17 +3,22 @@
|
|||
|
||||
if [ -d .git ]; then
|
||||
# Get version from git tags, removing the 'v' prefix
|
||||
VERSION=`git describe --match 'v*' 2>/dev/null | sed 's/^v//'`
|
||||
VERSION=$(git describe --match 'v*' 2>/dev/null | sed 's/^v//')
|
||||
fi
|
||||
|
||||
if [ -f .version ]; then
|
||||
# Get version from the .version file
|
||||
VERSION=`cat .version`
|
||||
VERSION=$(cat .version)
|
||||
fi
|
||||
|
||||
if [ -z "$VERSION" ] && [ -d .git ]; then
|
||||
# Fall back to short commit hash
|
||||
VERSION=0-$(git rev-parse --short HEAD 2>/dev/null)
|
||||
fi
|
||||
|
||||
if [ -z $VERSION ]; then
|
||||
VERSION="none"
|
||||
# No version, but still use a number
|
||||
VERSION="0"
|
||||
fi
|
||||
|
||||
printf '%s' "$VERSION"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue