home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
boot
/
i386
/
rescue
/
usr
/
lib
/
rpm
/
find-requires.ksyms
< prev
next >
Wrap
Text File
|
2006-11-29
|
1KB
|
59 lines
#! /bin/bash
IFS=$'\n'
case "$1" in
kernel-module-*) ;; # Fedora kernel module package names start with
# kernel-module.
kernel*) is_kernel_package=1 ;;
esac
all_provides() {
for module in "$@"; do
nm "$module"
done \
| sed -r -ne 's:^0*([0-9a-f]+) A __crc_(.+):\1\t\2:p' \
| sort -k2 -u
}
all_requires() {
for module in "$@"; do
set -- $(/sbin/modinfo -F vermagic "$module" | sed -e 's: .*::' -e q)
if [ -e "/boot/symsets-$1.tar.gz" ]; then
/sbin/modprobe --dump-modversions "$module" \
| sed -r -e 's:^0x0*::' -e 's:$:\t'"$1"':'
fi
done \
| sort -k2 -u
}
if ! [ -z "$is_kernel_package" -a -e /sbin/modinfo -a -e /sbin/modprobe ]; then
cat > /dev/null
exit 0
fi
modules=($(grep -E '/lib/modules/.+\.ko$'))
if [ ${#modules[@]} -gt 0 ]; then
symset_table=$(mktemp -t ${0##*/}.XXXXX)
/usr/lib/rpm/symset-table | sort > $symset_table
join -t $'\t' -j 1 -a 2 $symset_table <(
# Filter out requirements that we fulfill ourself.
join -t $'\t' -j 2 -v 1 \
<(all_requires "${modules[@]}") \
<(all_provides "${modules[@]}") \
| awk '
BEGIN { FS = "\t" ; OFS = "\t" }
{ print $3 "/" $2 "/" $1 }
' \
| sort -u) \
| sort -u \
| awk '
{ FS = "\t" ; OFS = "\t" }
NF == 3 { print "kernel(" $2 ") = " $3
next }
{ split($1, arr, "/")
print "ksym(" arr[3] ") = " arr[2] }
'
fi