Import Debian changes 1.8.5-1
[hcoop/debian/openafs.git] / debian / module / kernel-version
diff --git a/debian/module/kernel-version b/debian/module/kernel-version
new file mode 100755 (executable)
index 0000000..a1985a2
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+#
+# Extract the kernel version from the kernel version header file.  Takes the
+# kernel source path as its only argument.  If the version header couldn't be
+# found, print nothing and exit quietly.
+
+my $ksrc = shift;
+unless ($ksrc && open (VERSION, "$ksrc/include/linux/version.h")) {
+    exit 0;
+}
+my $found;
+my $line = <VERSION>;
+if ($line =~ /"(.+)"/) {
+    print "$1\n";
+    $found = 1;
+}
+exit 0 if $found;
+unless (open (VERSION, "$ksrc/include/config/kernel.release")) {
+    exit 0;
+}
+if ($line = <VERSION>) {
+    print "$line";
+}
+exit 0;