Add RT patch version macros
[lttng-modules.git] / rt-patch-version.sh
diff --git a/rt-patch-version.sh b/rt-patch-version.sh
new file mode 100755 (executable)
index 0000000..89c7755
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# First argument is the path to the kernel headers.
+KPATH=$1
+
+VERSIONFILE=""
+
+if [ -f "${KPATH}/localversion-rt" ]; then
+       VERSIONFILE="${KPATH}/localversion-rt"
+
+elif [ -f "${KPATH}/source/localversion-rt" ]; then
+       VERSIONFILE="${KPATH}/source/localversion-rt"
+else
+       echo 0
+       exit 0
+fi
+
+RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}")
+
+if [ "x${RT_PATCH_VERSION}" = "x" ]; then
+       echo 0
+       exit 0
+fi
+
+echo ${RT_PATCH_VERSION}
This page took 0.023175 seconds and 4 git commands to generate.