| 1 | #!/bin/sh |
| 2 | |
| 3 | # First argument is the path to the kernel headers. |
| 4 | KPATH="$1" |
| 5 | |
| 6 | if [ ! -f "${KPATH}/include/generated/utsrelease.h" ]; then |
| 7 | echo 0 |
| 8 | exit 0 |
| 9 | fi |
| 10 | |
| 11 | # Assuming KPATH is the target kernel headers directory |
| 12 | UTS_RELEASE=$(sed -rn 's/^#define UTS_RELEASE "(.*)"/\1/p' "${KPATH}/include/generated/utsrelease.h") |
| 13 | FEDORA_VERSION=$(echo "${UTS_RELEASE}" | sed -n 's/.*\.fc\([0-9]*\)\..*/\1/p') |
| 14 | |
| 15 | if [ "x${FEDORA_VERSION}" = "x" ]; then |
| 16 | echo 0 |
| 17 | exit 0 |
| 18 | fi |
| 19 | |
| 20 | FEDORA_REVISION_VERSION=$(echo "${UTS_RELEASE}" | sed -n 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\-\([0-9]*\).*/\4/p') |
| 21 | echo "${FEDORA_REVISION_VERSION}" |