File: rt-patch-version.sh

package info (click to toggle)
lttng-modules 2.14.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,808 kB
  • sloc: ansic: 74,851; sh: 548; makefile: 62
file content (27 lines) | stat: -rwxr-xr-x 566 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only)
# SPDX-FileCopyrightText: 2016-2018 EfficiOS Inc.

# First argument is the path to the kernel headers.
KPATH="$1"

VERSIONFILE=""

if [ -f "${KPATH}/localversion-rt" ]; then
	VERSIONFILE="${KPATH}/localversion-rt"

elif [ -f "${KPATH}/source/localversion-rt" ]; then
	VERSIONFILE="${KPATH}/source/localversion-rt"
else
	echo 0
	exit 0
fi

RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}")

if [ "x${RT_PATCH_VERSION}" = "x" ]; then
	echo 0
	exit 0
fi

echo "${RT_PATCH_VERSION}"