Fix: Always build vmscan probe
[lttng-modules.git] / abi-debian-version.sh
CommitLineData
72e6c528
MD
1#!/bin/sh
2
3# First argument is the path to the kernel headers.
4KPATH=$1
5
6if [ ! -f ${KPATH}/include/generated/package.h ]; then
7 echo 0
8 exit 0
9fi
10
11# Debian snippet courtesy of Ben Hutchings
12
13# Assuming KPATH is the target kernel headers directory
14DEB_PACKAGE_VERSION=$(sed -rn 's/^#define LINUX_PACKAGE_ID " Debian (.*)"/\1/p' ${KPATH}/include/generated/package.h)
15# Ignore backports part
16DEB_PACKAGE_VERSION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 's/~(bpo|deb).*//')
17# Get -ckt update number, if present
18KERNEL_CKT_UPDATE=$(echo ${DEB_PACKAGE_VERSION} | sed -rn 's/^[0-9]+\.[0-9]+\.[0-9]+-ckt([0-9]+).*/\1/p')
2a3427bf
MD
19
20# Only care about the rest if it is a -ckt kernel, making sure we do not
21# clash with older Debian kernels (e.g. Debian 3.2.65-1+deb7u2).
22if [ -z "${KERNEL_CKT_UPDATE}" ]; then
23 echo 0
24 exit 0
25fi
26
72e6c528
MD
27# Get package revision
28DEB_PACKAGE_REVISION=$(echo ${DEB_PACKAGE_VERSION} | sed -r 's/.*-([^-]+)$/\1/')
29# Get non-sec update number
30DEB_PACKAGE_REVISION_BASE=$(echo ${DEB_PACKAGE_REVISION} | sed -r 's/^([0-9]+).*/\1/')
31# Get security update number, if present
32DEB_PACKAGE_REVISION_SECURITY=$(echo ${DEB_PACKAGE_REVISION} | sed -rn 's/.*\+(squeeze|deb[0-9])+u([0-9]+)$/\1/p')
33test -n "${DEB_PACKAGE_REVISION_SECURITY}" || DEB_PACKAGE_REVISION_SECURITY=0
34# Combine all update numbers into one
35DEB_API_VERSION=$((KERNEL_CKT_UPDATE * 10000 + DEB_PACKAGE_REVISION_BASE * 100 + DEB_PACKAGE_REVISION_SECURITY))
36
37echo ${DEB_API_VERSION}
This page took 0.025644 seconds and 4 git commands to generate.