![](https://seccdn.libravatar.org/avatar/bcd65ca98f9d97839f15c54575c7edec.jpg?s=120&d=mm&r=g)
On 3/20/13 4:15 AM, Cristian Rodríguez wrote:
To support MODULES_LOADED_ON_BOOT systemd requires to carry a patch for yet another distribution specific hack.
remove this variable and migrate all users to the distribution-agnostic modules-load.d(5)
It's distribution-agnostic but is a systemd feature, not a general system feature. /etc/init.d/boot.loadmodules, also part of mkinitrd, should be adjusted to parse that when sysvinit is used. The loadmodules.service file masks it for systemd already. I am 100% in favor of getting rid of as many initrd hacks as we can. :) -Jeff
--- etc/sysconfig.kernel-mkinitrd | 10 ---------- mkinitrd.spec | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/etc/sysconfig.kernel-mkinitrd b/etc/sysconfig.kernel-mkinitrd index 89062a8..a958c2a 100644 --- a/etc/sysconfig.kernel-mkinitrd +++ b/etc/sysconfig.kernel-mkinitrd @@ -31,16 +31,6 @@ NO_KMS_IN_INITRD="no" # DOMU_INITRD_MODULES="xennet xenblk"
-## Type: string -## ServiceRestart: boot.loadmodules -# -# This variable contains the list of modules to be loaded -# once the main filesystem is active -# You will find a few default modules for hardware which -# can not be detected automatically. -# -MODULES_LOADED_ON_BOOT="" - ## Type: string ## Default: "" # diff --git a/mkinitrd.spec b/mkinitrd.spec index cebf70e..916fc66 100644 --- a/mkinitrd.spec +++ b/mkinitrd.spec @@ -157,6 +157,22 @@ install -m 644 etc/purge-kernels.service $RPM_BUILD_ROOT/%{_unitdir}/ %service_add_post purge-kernels.service %endif
+ +if [ -f /etc/sysconfig/kernel ]; then + . /etc/sysconfig/kernel + if [ -n "$MODULES_LOADED_ON_BOOT" ]; then + for m in $MODULES_LOADED_ON_BOOT ; do + if [ ! -f "/etc/modules-load.d/$m.conf" ]; then + tmpf=$(mktemp) || exit 1 + echo $m > $tmpf + mv $tmpf /etc/modules-load.d/$m.conf + fi + done + fi +fi + +%{remove_and_set -n kernel MODULES_LOADED_ON_BOOT} + %postun %insserv_cleanup %if 0%{?suse_version} >= 1210
-- Jeff Mahoney SUSE Labs