From 8b6c9a741d3bd2b357e96a500a05f08c4ce16ff5 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Sun, 7 Sep 2025 16:37:29 +0300 Subject: [PATCH] Add check-version.sh script --- check-version.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 check-version.sh diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..7e0e387 --- /dev/null +++ b/check-version.sh @@ -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"