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