开发者

rpm spec call uname -r

When I insta开发者_如何学Cll my app, I would like to copy some files in /lib/modules/KERNEL_VERSION/extra.

The problem of course is that KERNEL_VERSION is not fixed.

I can find it by calling "uname -r", but how do I do this in a rpm spec file?

Also, if there's a better method, I'm opened to ideas.


You could interpolate the result of uname -r into the directory (guessing here):

/lib/modules/`uname -r`/extra/


The answer to this question will probably leave you with symbol mismatches when trying to load kernel modules compiled for a different kernel.

To place the kernel modules at compile time, do as Delan answered:

%files
/lib/modules/`uname -r`/extra/*.ko

To place the previously compiled kernel modules in the currently running kernel's path, you will have to do something tricky in the %post section:

%post
cp /lib/modules/known/location/*.ko /lib/modules/`uname -r`/extra/*.ko

%postun
rm /lib/modules/... # hopefully they have not upgraded their current kernel..

%files
/lib/modules/known/location/*.ko

Which will install kernel modules that probably can't be loaded on the running kernel. Usually source RPMs are the solution for this exact problem.


This isn't a good idea because you should compile kernel modules on the client machine with a %triggerin so it survives a kernel upgrade.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜