Blame SOURCES/kmod.prov

a008c1
#!/bin/sh +x
32d5e8
# Kernel build can have many thousands of modules.
32d5e8
# kmod.prov is run for every one of them.
32d5e8
# Try to make this script run as fast as we can.
32d5e8
# For example, use shell string ops instead of external programs
32d5e8
# where possible.
a008c1
a008c1
IFS=$'\n'
a008c1
32d5e8
read -r fname || exit
a008c1
32d5e8
# Only process files from .../lib/modules/... subtree
32d5e8
[ "${fname#*/lib/modules/*}" != "$fname" ] || exit 0
32d5e8
32d5e8
kmod=${fname##*/}  # like basename, but faster
32d5e8
32d5e8
if [ "$kmod" = "modules.builtin" ]; then
32d5e8
        for j in $(cat -- "$fname"); do
32d5e8
                echo "kmod(${j##*/})"
32d5e8
        done
32d5e8
        exit 0
32d5e8
fi
32d5e8
32d5e8
kmod=${kmod%.gz}
32d5e8
kmod=${kmod%.xz}
32d5e8
if [ "${kmod%.ko}" != "$kmod" ]; then
32d5e8
        echo "kmod($kmod)"
32d5e8
fi