| 1 | #!/bin/sh |
| 2 | # SPDX-License-Identifier: (GPL-2.0-only OR LGPL-2.1-only) |
| 3 | # SPDX-FileCopyrightText: 2016-2018 EfficiOS Inc. |
| 4 | |
| 5 | # First argument is the path to the kernel headers. |
| 6 | KPATH="$1" |
| 7 | |
| 8 | VERSIONFILE="" |
| 9 | |
| 10 | if [ -f "${KPATH}/localversion-rt" ]; then |
| 11 | VERSIONFILE="${KPATH}/localversion-rt" |
| 12 | |
| 13 | elif [ -f "${KPATH}/source/localversion-rt" ]; then |
| 14 | VERSIONFILE="${KPATH}/source/localversion-rt" |
| 15 | else |
| 16 | echo 0 |
| 17 | exit 0 |
| 18 | fi |
| 19 | |
| 20 | RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}") |
| 21 | |
| 22 | if [ "x${RT_PATCH_VERSION}" = "x" ]; then |
| 23 | echo 0 |
| 24 | exit 0 |
| 25 | fi |
| 26 | |
| 27 | echo "${RT_PATCH_VERSION}" |