How do I make the system automatically run a script after a kernel update? | Nvidia Driver Build

I want the system to automatically install the nvidia driver on the new kernel.

Are you using nvidia driver from rpmfusion? They use a(utomatic)kmod which are being built automatically after each kernel update. After installing a new kernel, you need to wait a few minutes for the kmod to be compiled. Do not reboot right after kernel update.

No, I built it myself. I don’t like the hundreds of dependent packages installed by rpmfusion.

you can create a custom dnf plugin in python to run a shell script, or use the DNF post-transaction-actions plugin and configure it to run you custom shell script.

something like:

/etc/dnf/plugins/post-transaction-actions.conf

[main]
enabled=1

[mykernel]
command=/path/to/your/script.sh
transaction_type=install
package_names=kernel
1 Like
2 Likes

It doesn’t seem to pass the name of the kernel being installed to the script at this path /etc/kernel/install.d/?

Removed kernel-install

The kernel version and image are passed to the script as positional parameters.