Commit | Line | Data |
---|---|---|
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 | ||
7 | my $ksrc = shift; | |
8 | unless ($ksrc && open (VERSION, "$ksrc/include/linux/version.h")) { | |
9 | exit 0; | |
10 | } | |
11 | my $found; | |
12 | my $line = <VERSION>; | |
13 | if ($line =~ /"(.+)"/) { | |
14 | print "$1\n"; | |
15 | $found = 1; | |
16 | } | |
17 | exit 0 if $found; | |
18 | unless (open (VERSION, "$ksrc/include/config/kernel.release")) { | |
19 | exit 0; | |
20 | } | |
21 | if ($line = <VERSION>) { | |
22 | print "$line"; | |
23 | } | |
24 | exit 0; |