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