There might be reasons, you’d wish you could make the kernel module package do other things. Two already pop into my head: 1) The mpp-Image upgrades for the ibm-rdac kernel module packages and 2) the “adjustments” which need to be done post install for the VMware kernel module package in /etc/vmware-tools/locations.
What you basically do is this:
- Add the new subpkg template to your sources list
- Call the %suse_kernel_module_package macro with the option -s and then add your source number
For me this looks like this:
1 2 3 4 5 6 |
... Source4: vmxnet.tar Source5: preamble Source6: subpkg ... %suse_kernel_module_package -p %{S:5} -s %{S:6} um |
After that, you just need to copy over /usr/lib/rpm/rpm-suse-kernel-module-subpackage to /usr/src/packages/SOURCES/subpkg and make your adjustments to that copy.
For example the diff between those two could look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
--- /usr/lib/rpm/rpm-suse-kernel-module-subpackage +++ /usr/src/packages/SOURCES/subpkg @@ -20,8 +20,8 @@ ' $spec ) Provides: %{-n*} = %(echo %{-v*}-%3 | tr - _) -Requires: kernel-%1 -AutoReqProv: on +Requires: kernel-%1 = %( echo %2 | sed "s,-%1,," ) +AutoReqProv: off %{-p:%{expand:%(cd %_sourcedir; cat %{-p*})}} %description -n %{-n*}-%1 %( @@ -77,6 +77,21 @@ done fi fi +if [ -f /etc/vmware-tools/locations ] ; then + for kmodule in ${modules[@]}; do + echo "file $kmodule $( stat -c %Y $kmodule )" + >> /etc/vmware-tools/locations + echo "file $( echo $kmodule | + sed -e "s,.ko,.o," -e "s,updates,misc," )" + >> /etc/vmware-tools/locations + echo "answer $( echo ${kmodule##*/} | sed -e "s,.ko,," | + tr '[:lower:]' '[:upper:]' )_CONFED yes" + >> /etc/vmware-tools/locations + done + + [ -f /etc/vmware-tools/not_configured ] && + rm -f /etc/vmware-tools/not_configured +fi %{-i:%{expand:%(cd %_sourcedir; cat %{-i*})}} %preun -n %{-n*}-%1 version=%(echo %{-v*}-%3 | tr - _) @@ -116,8 +131,29 @@ done fi fi +if [ -f /etc/vmware-tools/locations ] ; then + for kmodule in ${modules[@]}; do + MOD="$( echo ${kmodule##*/} | sed -e "s,.ko,," | + tr '[:lower:]' '[:upper:]' )_CONFED yes" + [ -n "$( grep "$MOD" /etc/vmware-tools/locations )" ] && + sed -i "/$MOD/d" /etc/vmware-tools/locations + + [ -n "$( grep "file $kmodule" /etc/vmware-tools/locations )" ] && + sed -i "/file ${kmodule////\/}.*/d" /etc/vmware-tools/locations + + MOD="$( echo $kmodule | sed -e "s,.ko,.o," -e "s,updates,misc," )" + [ -n "$( grep "file $MOD" /etc/vmware-tools/locations )" ] && + sed -i "/file $( echo $MOD | sed -e "s,/,\/,g" )/d" + /etc/vmware-tools/locations + done + + [ ! -f /etc/vmware-tools/not_configured ] && + touch /etc/vmware-tools/not_configured +fi %{-u:%{expand:%(cd %_sourcedir; cat %{-u*})}} %files -n %{-n*}-%1 %{-f:%{expand:%(cd %_sourcedir; cat %{-f*})}} %{!-f:%defattr (-,root,root)} %{!-f:/lib/modules/%2} + +# vim: set syntax=on ft=sh : |
This is my final version of the subpkg template and I hopefully demonstrated how powerful a customized subpkg template can be!