diff --git a/kabi.attr b/kabi.attr new file mode 100644 index 0000000..85d30a2 --- /dev/null +++ b/kabi.attr @@ -0,0 +1,2 @@ +%__kabi_provides %{_rpmconfigdir}/kabi.sh +%__kabi_path ^/lib/modules/[1-9].*/symvers.gz$ diff --git a/kabi.sh b/kabi.sh new file mode 100644 index 0000000..0afa5ad --- /dev/null +++ b/kabi.sh @@ -0,0 +1,13 @@ +#!/bin/bash +x +# +# kabi.sh - Automatically extract any kernel symbol checksum from the +# symvers file and add to RPM deps. This is used to move the +# checksum checking from modprobe to rpm install for 3rd party +# modules (so they can fail during install and not at load). + +IFS=$'\n' + +for symvers in $(grep -E '/lib/modules/[1-9].*/symvers\.gz') "$@"; +do + zcat $symvers | awk ' {print "kernel(" $2 ") = " $1 }' +done diff --git a/kernel-srpm-macros.spec b/kernel-srpm-macros.spec index 6188dcb..c0fa367 100644 --- a/kernel-srpm-macros.spec +++ b/kernel-srpm-macros.spec @@ -30,6 +30,10 @@ Source300: kmodtool Source301: rpmsort Source302: symset-table +# kabi provides generator +Source400: kabi.attr +Source401: kabi.sh + %global rrcdir /usr/lib/rpm/redhat @@ -74,13 +78,17 @@ install -p -m 755 -t %{buildroot}%{rrcdir}/find-provides.d firmware.prov modalia install -p -m 644 -t %{buildroot}%{_rpmconfigdir}/macros.d macros.kmp install -p -m 644 -t %{buildroot}%{_fileattrsdir} kmod.attr +install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" kabi.attr +install -p -m 755 -t "%{buildroot}%{_rpmconfigdir}" kabi.sh %files %{_rpmconfigdir}/macros.d/macros.kernel-srpm %{_fileattrsdir}/kmod.attr %files -n kernel-rpm-macros +%{_rpmconfigdir}/kabi.sh %{_rpmconfigdir}/macros.d/macros.kmp +%{_fileattrsdir}/kabi.attr %dir %{rrcdir}/find-provides.d %{rrcdir}/kmodtool %{rrcdir}/rpmsort