| 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 | VERSIONFILE="" |
| 8 | |
| 9 | if [ -f "${KPATH}/localversion-rt" ]; then |
| 10 | VERSIONFILE="${KPATH}/localversion-rt" |
| 11 | |
| 12 | elif [ -f "${KPATH}/source/localversion-rt" ]; then |
| 13 | VERSIONFILE="${KPATH}/source/localversion-rt" |
| 14 | else |
| 15 | echo 0 |
| 16 | exit 0 |
| 17 | fi |
| 18 | |
| 19 | RT_PATCH_VERSION=$(sed -rn 's/^-rt([0-9]+)$/\1/p' "${VERSIONFILE}") |
| 20 | |
| 21 | if [ "x${RT_PATCH_VERSION}" = "x" ]; then |
| 22 | echo 0 |
| 23 | exit 0 |
| 24 | fi |
| 25 | |
| 26 | echo "${RT_PATCH_VERSION}" |