backport to buster
[hcoop/debian/openafs.git] / debian / module / kernel-version
CommitLineData
b7cfede0
BK
1#!/usr/bin/perl
2#
3# Extract the kernel version from the kernel version header file. Takes the
4# kernel source path as its only argument. If the version header couldn't be
5# found, print nothing and exit quietly.
6
7my $ksrc = shift;
8unless ($ksrc && open (VERSION, "$ksrc/include/linux/version.h")) {
9 exit 0;
10}
11my $found;
12my $line = <VERSION>;
13if ($line =~ /"(.+)"/) {
14 print "$1\n";
15 $found = 1;
16}
17exit 0 if $found;
18unless (open (VERSION, "$ksrc/include/config/kernel.release")) {
19 exit 0;
20}
21if ($line = <VERSION>) {
22 print "$line";
23}
24exit 0;