summaryrefslogtreecommitdiff
path: root/packaging/find-provides.ksyms
blob: c8f2ccda6d25fc7e97b4f8ec0b498dfd969729cd (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /bin/sh

IFS=$'\n'

case "$1" in
kernel-module-*)    ;; # Fedora kernel module package names start with
		       # kernel-module.
kernel*)	    kernel_flavor=${1#kernel-} ;;
esac

trap 'rm -f "$tmp"' EXIT
tmp=$(mktemp)
while read f; do
    test -e "$f" || continue
    case "$f" in
    *.debug)
        continue
        ;;
    */lib/modules/*/*.ko | */lib/modules/*/*.ko.gz | */boot/vmlinu[xz]*)
        ;;
    *)
        continue
    esac
    unzip=false
    case "$f" in
    *.gz | */boot/vmlinuz*)
        unzip=true
    esac
    if $unzip && gzip -cd "$f" >"$tmp"; then
        f=$tmp
    fi
    flavor=$(/usr/sbin/modinfo -F vermagic "$f")
    flavor=${flavor%% *}
    flavor=${flavor##*-}
    if test -z "$flavor"; then
        flavor=$kernel_flavor
    fi
    nm "$f" \
    | sed -r -ne "s/^0*([0-9a-f]+) A __crc_(.+)/ksym($flavor:\\2) = \\1/p"
done \
| sort -u