2017-09-20 17:29:49 +02:00
|
|
|
--- macros.in.orig
|
|
|
|
+++ macros.in
|
|
|
|
@@ -487,7 +487,7 @@ package or when debugging this package.\
|
|
|
|
%__find_requires %{_rpmconfigdir}/find-requires %name
|
2008-09-12 20:37:28 +02:00
|
|
|
#%__find_conflicts ???
|
|
|
|
#%__find_obsoletes ???
|
|
|
|
-#%__find_supplements ???
|
2017-09-20 17:29:49 +02:00
|
|
|
+%__find_supplements %{_rpmconfigdir}/find-supplements %name
|
2008-09-12 20:37:28 +02:00
|
|
|
#%__find_enhances ???
|
|
|
|
|
2011-05-16 18:07:44 +02:00
|
|
|
#
|
2017-09-20 17:29:49 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ scripts/find-supplements
|
|
|
|
@@ -0,0 +1,14 @@
|
2015-01-23 18:36:17 +01:00
|
|
|
+#!/bin/bash
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
2017-09-20 17:29:49 +02:00
|
|
|
+# This script reads filenames from STDIN and outputs any relevant provides
|
|
|
|
+# information that needs to be included in the package.
|
2006-12-19 00:17:44 +01:00
|
|
|
+IFS=$'\n'
|
2017-09-20 17:29:49 +02:00
|
|
|
+filelist=($(cat))
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
2017-09-20 17:29:49 +02:00
|
|
|
+#
|
|
|
|
+# --- Kernel module hardware identifiers
|
|
|
|
+# (e.g., modalias(pci:v0000109Ed00000878sv00000070sd0000FF01bc*sc*i*)
|
|
|
|
+[ -x /usr/lib/rpm/find-supplements.ksyms ] &&
|
|
|
|
+ printf "%s\n" "${filelist[@]}" | /usr/lib/rpm/find-supplements.ksyms "$@"
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
2017-09-20 17:29:49 +02:00
|
|
|
+exit 0
|
|
|
|
--- /dev/null
|
|
|
|
+++ scripts/find-supplements.ksyms
|
|
|
|
@@ -0,0 +1,45 @@
|
|
|
|
+#!/bin/bash
|
|
|
|
+
|
|
|
|
+IFS=$'\n'
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
|
|
|
+print_modaliases() {
|
|
|
|
+ declare class=$1 variants=$2 pos=$3
|
|
|
|
+ if [ -n "$variants" ]; then
|
|
|
|
+ echo "${class:0:pos}[$variants]${class:pos+1}"
|
|
|
|
+ else
|
|
|
|
+ [ -z "$class" ] || echo "$class"
|
|
|
|
+ fi
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+combine_modaliases() {
|
|
|
|
+ declare tag class variants pos n
|
|
|
|
+ read class
|
|
|
|
+ while read tag; do
|
|
|
|
+ for ((n=0; n<${#class}; n++)); do
|
|
|
|
+ if [ "*" != "${class:n:1}" -a \
|
|
|
|
+ "${class:0:n}" = "${tag:0:n}" -a \
|
|
|
|
+ "${class:n+1}" = "${tag:n+1}" ] &&
|
|
|
|
+ ( [ -z "$pos" ] || [ $n = $pos ] ); then
|
|
|
|
+ variants="${variants:-${class:n:1}}${tag:n:1}"
|
|
|
|
+ pos=$n
|
|
|
|
+ break
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+ if [ $n -eq ${#class} ]; then
|
|
|
|
+ print_modaliases "$class" "$variants" "$pos"
|
|
|
|
+ variants=
|
|
|
|
+ pos=
|
|
|
|
+ class=$tag
|
|
|
|
+ fi
|
|
|
|
+ done
|
|
|
|
+ print_modaliases "$class" "$variants" "$pos"
|
|
|
|
+}
|
|
|
|
+
|
2017-09-20 17:29:49 +02:00
|
|
|
+for module in $(grep -E '/lib/modules/.+\.ko$' | grep -v '/lib/modules/[^/]*/kernel/'); do
|
2006-12-19 00:17:44 +01:00
|
|
|
+ vermagic=$(/sbin/modinfo -F vermagic "$module")
|
|
|
|
+ krel=${vermagic%% *}
|
|
|
|
+ /sbin/modinfo -F alias "$module" \
|
|
|
|
+ | sed -nre "s,(.+:.+),modalias(kernel-${krel##*-}:\\1),p"
|
|
|
|
+done \
|
|
|
|
+| sort -u \
|
|
|
|
+| combine_modaliases
|