Update btrfs instrumentation for 4.10 kernel
[lttng-modules.git] / abi-sle-version.sh
CommitLineData
c6dd600b
MJ
1#!/bin/sh
2
3# First argument is the path to the kernel headers.
4KPATH=$1
5
6if [ ! -f "${KPATH}/include/generated/autoconf.h" ]; then
7 echo 0
8 exit 0
9fi
10
11# Check if we are building against a Suse kernel
12SUSE_KERNEL="$(sed -rn 's/^#define CONFIG_SUSE_KERNEL (.*)/\1/p' "${KPATH}/include/generated/autoconf.h")"
13
14if [ "$SUSE_KERNEL" != "1" ]; then
15 echo 0
16 exit 0
17fi
18
19
20if [ ! -f "${KPATH}/include/generated/utsrelease.h" ]; then
21 echo 0
22 exit 0
23fi
24
25SLE_RELEASE="$(sed -rn 's/^#define UTS_RELEASE "(.*)-([0-9\.]+)-(.*)"/\2/p' "${KPATH}/include/generated/utsrelease.h")"
26
27SLE_RELEASE_MAJOR="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)(.*)$/\1/p')"
28SLE_RELEASE_MINOR="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)\.([0-9]+)(.*)$/\2/p')"
29SLE_RELEASE_PATCH="$(echo "${SLE_RELEASE}" | sed -rn 's/^([0-9]+)\.([0-9]+)\.([0-9]+)(.*)$/\3/p')"
30
31# Minor and patch versions can be omitted
32if [ "x$SLE_RELEASE_MINOR" = "x" ]; then
33 SLE_RELEASE_MINOR=0
34fi
35if [ "x$SLE_RELEASE_PATCH" = "x" ]; then
36 SLE_RELEASE_PATCH=0
37fi
38
39# Combine all update numbers into one
40SLE_API_VERSION="$((SLE_RELEASE_MAJOR * 10000 + SLE_RELEASE_MINOR * 100 + SLE_RELEASE_PATCH))"
41
42echo ${SLE_API_VERSION}
This page took 0.024395 seconds and 4 git commands to generate.