Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RPM require kernel-devel package of currently installed kernel

I have written an RPM spec that has a requirement for the kernel-devel package. However, that is satisfied by the installation of any kernel-devel package. How do I specify that the RPM requires the kernel-devel package of the currently running kernel version.

For example, our customer could be running 3.10.0-514, however the latest is 3.10.0-693. If you execute "yum install -y kernel-devel" you get the headers for the latest version, satisfying the "Requires" line in my RPM. I want to ensure that the headers installed are for 3.10.0-514.

like image 651
Mike Avatar asked Oct 18 '22 01:10

Mike


1 Answers

You can't. I've been wrangling with this for years.

You also can't use triggers to watch when kernel-devel is installed, because when it is installed, it still won't match the running kernel version.

The solution I have used is to put a custom script into /etc/init.d/ (or the systemd equivalents) that recompiles the driver on demand each time the OS boots with a potentially-new kernel. And it is smart enough to recognize if the sources aren't there to tell the user to upgrade that as well.

like image 170
Aaron D. Marasco Avatar answered Oct 21 '22 04:10

Aaron D. Marasco