aboutsummaryrefslogtreecommitdiffstats
path: root/kmod.prov
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-08-25 18:23:04 +0000
committerOlivier Blin <oblin@mandriva.com>2007-08-25 18:23:04 +0000
commita2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19 (patch)
tree6916caa3a899a86ddbd1e99e43232648b2c15e53 /kmod.prov
parentd47bdd8c207d2c6d23144844db62b00c8991a03a (diff)
downloadrpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.tar
rpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.tar.gz
rpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.tar.bz2
rpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.tar.xz
rpm-setup-a2ee6a6b2b1bb5bc44df4c91858c3f68e99f6c19.zip
add automatic kmod provides (based on work from Danny Tholen)
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;
+}
+'