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