Equivalent of update-grub for RHEL/Fedora/CentOS systems?
In Ubuntu (and I guess in Debian too) there is a system script named
update-grubwhich automatically executes
grub-mkconfig -owith the correct path for the grub configuration file.
Is there any similar command for Red Hat based distributions?
If not, how do the system knows where is the grub configuration file to update when a new kernel version is installed?
Specific actions that need to happen when a RPM package is installed or removed are included within the RPM package itself in pre-install, post-install, pre-uninstall and post-uninstall sections.
For every installed RPM package you can query the RPM database for the exact scripts that are included with the
rpm -q --scripts <package-name>
Running that command on a kernel package for CentOS 6 returns among others:
postinstall scriptlet (using /bin/sh): <snip> /sbin/new-kernel-pkg --package kernel --install 2.6.32-431.17.1.el6.x86_64 || exit $?
From the manual:
new-kernel-package- tool to script kernel installation
running the same command on Fedora 20 yields `/bin/kernel-install` instead. Please edit your answer to include this information for future reference
That is exactly why I started my answer with the steps needed to find out. I think querying the installation scripts is likely to be pretty universal in the RPM world in helping you understand how the kernel update is effected. That way my answer will withstand the test of time much better than only naming a tool/command/support-script which you already demonstrated is very release and distribution dependent.