blob: dcd9aa1f55223d0556f08964b436645bb111c93b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/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;
}
'
dkmslist=$(echo "$provideslist" | egrep '/usr/src/[^/]*/dkms.conf$')
[ -n "$dkmslist" ] && echo $dkmslist | while read d; do
VERSION=`sed -rne 's/^PACKAGE_VERSION="?([^"]+)"?$/\1/;T;p' $d`
[ -z "$VERSION" ] && continue
MODULES=`sed -rne 's/^BUILT_MODULE_NAME\[[0-9]+\]="?([^"]+)"?$/\1/;T;p' $d`
if [ -z "$MODULES" ]; then
# default on PACKAGE_NAME if no BUILT_MODULE_NAME is specified
MODULES=`sed -rne 's/^PACKAGE_NAME="?([^"]+)"?$/\1/;T;p' $d`
fi
echo "$MODULES" | while read m; do
echo "kmod($m) = $VERSION"
done
done
|