Blame 0019-systemd-add-modules-load.d-modules-to-the-initramfs.patch

Harald Hoyer a20c0e
From 727543c1e65d94be8e2f1540b616a6e87d3053cb Mon Sep 17 00:00:00 2001
Harald Hoyer a20c0e
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer a20c0e
Date: Wed, 13 Mar 2013 10:51:47 +0100
Harald Hoyer a20c0e
Subject: [PATCH] systemd: add modules-load.d modules to the initramfs
Harald Hoyer a20c0e
Harald Hoyer a20c0e
---
Harald Hoyer a20c0e
 modules.d/98systemd/module-setup.sh | 23 +++++++++++++++++++++++
Harald Hoyer a20c0e
 1 file changed, 23 insertions(+)
Harald Hoyer a20c0e
Harald Hoyer a20c0e
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
Harald Hoyer a20c0e
index 443481a..6b00be5 100755
Harald Hoyer a20c0e
--- a/modules.d/98systemd/module-setup.sh
Harald Hoyer a20c0e
+++ b/modules.d/98systemd/module-setup.sh
Harald Hoyer a20c0e
@@ -16,6 +16,7 @@ depends() {
Harald Hoyer a20c0e
 }
Harald Hoyer a20c0e
 
Harald Hoyer a20c0e
 install() {
Harald Hoyer a20c0e
+    local _mods
Harald Hoyer a20c0e
 
Harald Hoyer a20c0e
     SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
Harald Hoyer a20c0e
     if (( $SYSTEMD_VERSION < 198 )); then
Harald Hoyer a20c0e
@@ -109,6 +110,26 @@ install() {
Harald Hoyer a20c0e
     dracut_install -o \
Harald Hoyer a20c0e
         /usr/lib/modules-load.d/*.conf
Harald Hoyer a20c0e
 
Harald Hoyer a20c0e
+    modules_load_get() {
Harald Hoyer a20c0e
+        local _line i
Harald Hoyer a20c0e
+        for i in "$1"/*.conf; do
Harald Hoyer a20c0e
+            [[ -f $i ]] || continue
Harald Hoyer a20c0e
+            while read _line; do
Harald Hoyer a20c0e
+                case $_line in
Harald Hoyer a20c0e
+                    \#*)
Harald Hoyer a20c0e
+                        ;;
Harald Hoyer a20c0e
+                    \;*)
Harald Hoyer a20c0e
+                        ;;
Harald Hoyer a20c0e
+                    *)
Harald Hoyer a20c0e
+                        echo $_line
Harald Hoyer a20c0e
+                esac
Harald Hoyer a20c0e
+            done < "$i"
Harald Hoyer a20c0e
+        done
Harald Hoyer a20c0e
+    }
Harald Hoyer a20c0e
+
Harald Hoyer a20c0e
+    _mods=$(modules_load_get /usr/lib/modules-load.d)
Harald Hoyer a20c0e
+    [[ $_mods ]] && instmods $_mods
Harald Hoyer a20c0e
+
Harald Hoyer a20c0e
     if [[ $hostonly ]]; then
Harald Hoyer a20c0e
         dracut_install -o \
Harald Hoyer a20c0e
             /etc/systemd/journald.conf \
Harald Hoyer a20c0e
@@ -120,6 +141,8 @@ install() {
Harald Hoyer a20c0e
 
Harald Hoyer a20c0e
         dracut_install -o \
Harald Hoyer a20c0e
             /etc/modules-load.d/*.conf
Harald Hoyer a20c0e
+        _mods=$(modules_load_get /etc/modules-load.d)
Harald Hoyer a20c0e
+        [[ $_mods ]] && instmods $_mods
Harald Hoyer a20c0e
     else
Harald Hoyer a20c0e
         if ! [[ -e "$initdir/etc/machine-id" ]]; then
Harald Hoyer a20c0e
             > "$initdir/etc/machine-id"