2006-12-19 00:17:44 +01:00
|
|
|
--- scripts/find-supplements.ksyms
|
2006-12-19 00:17:44 +01:00
|
|
|
+++ scripts/find-supplements.ksyms
|
2008-05-06 18:29:40 +02:00
|
|
|
@@ -1,6 +1,8 @@
|
2006-12-19 00:17:44 +01:00
|
|
|
#! /bin/sh
|
|
|
|
|
2008-11-28 14:34:30 +01:00
|
|
|
+SPECFILE=${RPMBUILD_SPECFILE:-/usr/src/packages/SOURCES/$1.spec}
|
2006-12-19 00:17:44 +01:00
|
|
|
IFS=$'\n'
|
2008-05-06 18:29:40 +02:00
|
|
|
+PACKAGE=$1
|
2006-12-19 00:17:44 +01:00
|
|
|
|
|
|
|
case "$1" in
|
2008-05-06 18:29:40 +02:00
|
|
|
kernel-module-*) ;; # Fedora kernel module package names start with
|
|
|
|
@@ -47,10 +49,53 @@
|
2006-12-19 00:17:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-for module in $(grep -E '/lib/modules/.+\.ko$'); do
|
|
|
|
- vermagic=$(/sbin/modinfo -F vermagic "$module")
|
|
|
|
- krel=${vermagic%% *}
|
|
|
|
- /sbin/modinfo -F alias "$module" \
|
|
|
|
- | sed -nre "s,(.+:.+),modalias(kernel-${krel##*-}:\\1),p"
|
|
|
|
-done \
|
|
|
|
+aliases_of_filelist() {
|
2008-05-06 18:29:40 +02:00
|
|
|
+ modlist=$(mktemp)
|
|
|
|
+ have_module=1
|
2006-12-19 00:17:44 +01:00
|
|
|
+ for module in $(grep -E '/lib/modules/.+\.ko$'); do
|
|
|
|
+ vermagic=$(/sbin/modinfo -F vermagic "$module")
|
|
|
|
+ krel=${vermagic%% *}
|
2008-05-06 18:29:40 +02:00
|
|
|
+ if ! test -x /sbin/modinfo; then
|
|
|
|
+ echo "ERROR: add module-init-tools to BuildRequires" >&2
|
|
|
|
+ exit 1
|
|
|
|
+ fi
|
|
|
|
+ have_module=0
|
2006-12-19 00:17:44 +01:00
|
|
|
+ /sbin/modinfo -F alias "$module" \
|
2008-05-06 18:29:40 +02:00
|
|
|
+ | sed -nre "s,(.+:.+),modalias(kernel-${krel##*-}:\\1),p" | tee -a $modlist
|
2006-12-19 00:17:44 +01:00
|
|
|
+ done
|
2008-05-06 18:29:40 +02:00
|
|
|
+ if ! test -s "$modlist" && test $have_module = 0; then
|
|
|
|
+ echo "packageand(kernel-${krel##*-}:$PACKAGE-kmp)"
|
|
|
|
+ fi
|
|
|
|
+ rm -f $modlist
|
2006-12-19 00:17:44 +01:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+aliases_of_specfile_macro() {
|
|
|
|
+ declare regex
|
|
|
|
+
|
|
|
|
+ regex=$(
|
|
|
|
+ set -o noglob
|
|
|
|
+ set -- $(sed -ne 's:^%supplements_kernel_module[ \t]::p' \
|
2008-11-28 14:34:30 +01:00
|
|
|
+ $SPECFILE)
|
2006-12-19 00:17:44 +01:00
|
|
|
+ while [ $# -ge 1 ]; do
|
|
|
|
+ regex=$(echo "$1" \
|
|
|
|
+ | sed -e 's:[.]:\\.:g' \
|
|
|
|
+ -e 's:?:.:g' \
|
|
|
|
+ -e 's:\*:.*:g' \
|
|
|
|
+ -e 's:\\:\\\\:g')
|
|
|
|
+ echo -n "^$regex\$"
|
|
|
|
+ [ $# -ge 2 ] && echo -n "|"
|
|
|
|
+ shift
|
|
|
|
+ done
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ if [ -n "$regex" ]; then
|
|
|
|
+ awk '
|
|
|
|
+ $1 == "alias" && $3 ~ regex { print $2 }
|
|
|
|
+ ' regex="$regex" /lib/modules/*/modules.alias
|
|
|
|
+ fi
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+( aliases_of_filelist
|
|
|
|
+ aliases_of_specfile_macro "$1"
|
|
|
|
+) \
|
|
|
|
| sort -u \
|
|
|
|
| combine_modaliases
|