Add check-version.sh script
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Git repository
|
||||||
|
REPO="https://git.kernel.org/pub/scm/libs/libcap/libcap.git"
|
||||||
|
|
||||||
|
# Get tag name using 'git ls-remote'
|
||||||
|
TAG_NAME=$(git ls-remote --exit-code --refs --tags --sort='v:refname' "$REPO" | cut -d'/' -f3 | grep '^libcap-' | tail -n1)
|
||||||
|
|
||||||
|
# Get version number from tag name
|
||||||
|
VERSION=$(echo "$TAG_NAME" | rev | cut -d'-' -f1 | rev)
|
||||||
|
|
||||||
|
# Trim 'v' character in VERSION variable
|
||||||
|
VERSION=$(echo "$VERSION" | tr -d 'v')
|
||||||
|
|
||||||
|
echo "$VERSION"
|
||||||
Reference in New Issue
Block a user