Handle config.guess and config.sub with DOS EOLs
[platform/upstream/rpm.git] / packaging / find-provides.ksyms
1 #! /bin/sh
2
3 IFS=$'\n'
4
5 case "$1" in
6 kernel-module-*)    ;; # Fedora kernel module package names start with
7                        # kernel-module.
8 kernel*)            kernel_flavor=${1#kernel-} ;;
9 esac
10
11 trap 'rm -f "$tmp"' EXIT
12 tmp=$(mktemp)
13 while read f; do
14     test -e "$f" || continue
15     case "$f" in
16     *.debug)
17         continue
18         ;;
19     */lib/modules/*/*.ko | */lib/modules/*/*.ko.gz | */boot/vmlinu[xz]*)
20         ;;
21     *)
22         continue
23     esac
24     unzip=false
25     case "$f" in
26     *.gz | */boot/vmlinuz*)
27         unzip=true
28     esac
29     if $unzip && gzip -cd "$f" >"$tmp"; then
30         f=$tmp
31     fi
32     flavor=$(/usr/sbin/modinfo -F vermagic "$f")
33     flavor=${flavor%% *}
34     flavor=${flavor##*-}
35     if test -z "$flavor"; then
36         flavor=$kernel_flavor
37     fi
38     nm "$f" \
39     | sed -r -ne "s/^0*([0-9a-f]+) A __crc_(.+)/ksym($flavor:\\2) = \\1/p"
40 done \
41 | sort -u