Remove obsolete -ckt debian kernel version support
[lttng-modules.git] / scripts / abi-debian-version.sh
... / ...
CommitLineData
1#!/bin/sh
2# SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only)
3
4# First argument is the path to the kernel headers.
5KPATH="$1"
6
7if [ ! -f "${KPATH}/include/generated/package.h" ]; then
8 echo 0
9 exit 0
10fi
11
12# Debian snippet courtesy of Ben Hutchings
13
14# Assuming KPATH is the target kernel headers directory
15DEB_PACKAGE_VERSION=$(sed -rn 's/^#define LINUX_PACKAGE_ID " Debian (.*)"/\1/p' "${KPATH}/include/generated/package.h")
16
17# Ignore backports part
18DEB_PACKAGE_VERSION=$(echo "${DEB_PACKAGE_VERSION}" | sed -r 's/~(bpo|deb).*//')
19
20# Get package revision
21DEB_PACKAGE_REVISION=$(echo "${DEB_PACKAGE_VERSION}" | sed -r 's/.*-([^-]+)$/\1/')
22# Get non-sec update number
23DEB_PACKAGE_REVISION_BASE=$(echo "${DEB_PACKAGE_REVISION}" | sed -r 's/^([0-9]+).*/\1/')
24# Get security update number, if present
25DEB_PACKAGE_REVISION_SECURITY=$(echo "${DEB_PACKAGE_REVISION}" | sed -rn 's/.*\+(squeeze|deb[0-9]+)+u([0-9]+)$/\2/p')
26test -n "${DEB_PACKAGE_REVISION_SECURITY}" || DEB_PACKAGE_REVISION_SECURITY=0
27# Combine all update numbers into one
28DEB_API_VERSION=$((DEB_PACKAGE_REVISION_BASE * 100 + DEB_PACKAGE_REVISION_SECURITY))
29
30echo ${DEB_API_VERSION}
This page took 0.021672 seconds and 4 git commands to generate.