aboutsummaryrefslogtreecommitdiffstats
path: root/kmod.prov
diff options
context:
space:
mode:
Diffstat (limited to 'kmod.prov')
-rwxr-xr-xkmod.prov13
1 files changed, 13 insertions, 0 deletions
diff --git a/kmod.prov b/kmod.prov
new file mode 100755
index 0000000..f378ec3
--- /dev/null
+++ b/kmod.prov
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+provideslist=`sed "s/['\"]/\\\&/g"`
+modulelist=$(echo "$provideslist" | egrep '^.*(/lib/modules/|/var/lib/dkms/).*\.ko(\.gz)?$')
+echo $modulelist | xargs -r /sbin/modinfo | \
+ perl -lne '
+$name = $1 if m!^filename:.*\b([^/]+)\.k?o!;
+$ver = $1 if /^version:\s*[a-zA-Z]{0,6}\-?(\d+[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*[\.\:\-\[\]]?\d*-?[a-zA-Z]{0,6}\d?).*/;
+if (/^srcversion:/) {
+ print "kmod\($name\) = $ver" if $name && $ver;
+ undef $name, $ver;
+}
+'