Fix: update writeback instrumentation for kernel 4.14
[lttng-modules.git] / abi-rhel-version.sh
CommitLineData
c94ac1ac
MJ
1#!/bin/sh
2
3# First argument is the path to the kernel headers.
4KPATH=$1
5
6if [ ! -f ${KPATH}/include/generated/uapi/linux/version.h ]; then
7 echo 0
8 exit 0
9fi
10
11# Assuming KPATH is the target kernel headers directory
12RHEL_RELEASE=$(sed -rn 's/^#define RHEL_RELEASE "(.*)"/\1/p' ${KPATH}/include/generated/uapi/linux/version.h)
13
14RHEL_RELEASE_MAJOR=$(echo ${RHEL_RELEASE} | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\1/')
15RHEL_RELEASE_MINOR=$(echo ${RHEL_RELEASE} | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\2/')
16RHEL_RELEASE_PATCH=$(echo ${RHEL_RELEASE} | sed -r 's/^([0-9]+)\.([0-9]+)\.([0-9]+)/\3/')
17
18# Combine all update numbers into one
19RHEL_API_VERSION=$((RHEL_RELEASE_MAJOR * 10000 + RHEL_RELEASE_MINOR * 100 + RHEL_RELEASE_PATCH))
20
21echo ${RHEL_API_VERSION}
This page took 0.023325 seconds and 4 git commands to generate.