46 lines
1.1 KiB
Plaintext
46 lines
1.1 KiB
Plaintext
|
#!/bin/bash
|
||
|
#
|
||
|
# Generate dependencies for KMPs defined in supported.conf. We look at each
|
||
|
# modules 'depends' field in modinfo and use the $name-kmp-modules lists
|
||
|
# in builddir to map dependencies to package names. We do it this way instead
|
||
|
# of relying on the ksym() dependencies, because KMPs built from the kernel
|
||
|
# spec file are not shared among kernel versions.
|
||
|
|
||
|
package_name=$1
|
||
|
version_release=$2
|
||
|
builddir=$3
|
||
|
|
||
|
trap 'rm -f "$filelist"' EXIT
|
||
|
filelist=$(mktemp -t ${0##*/}.XXXXXXXXXX)
|
||
|
cat >"$filelist"
|
||
|
|
||
|
# is this module part of any KMP?
|
||
|
in_kmp()
|
||
|
{
|
||
|
local mod=${1//[-_]/[-_]} res
|
||
|
|
||
|
for f in "$builddir"/*-kmp-modules; do
|
||
|
if grep -q "/$mod\$" "$f"; then
|
||
|
res=${f##*/}
|
||
|
echo "${res%-modules}"
|
||
|
fi
|
||
|
done
|
||
|
}
|
||
|
|
||
|
grep '\.ko$' "$filelist" | while read f; do
|
||
|
mod=${f##*/}
|
||
|
kmp=$(in_kmp "$mod")
|
||
|
if test -z "$kmp"; then
|
||
|
continue
|
||
|
fi
|
||
|
for dep in $(IFS=,; set -- $(/sbin/modinfo -F depends "$f"); echo $*); do
|
||
|
kmp2=$(in_kmp "$dep.ko")
|
||
|
if test -n "$kmp2" -a "$kmp2" != "$kmp"; then
|
||
|
# Needs another KMP
|
||
|
echo "$kmp2-${package_name#kernel-} = $version_release"
|
||
|
fi
|
||
|
done
|
||
|
done
|
||
|
|
||
|
/usr/lib/rpm/find-requires "$package_name" <"$filelist"
|