]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
systemd: add modules-load.d modules to the initramfs
authorHarald Hoyer <harald@redhat.com>
Wed, 13 Mar 2013 09:51:47 +0000 (10:51 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 13 Mar 2013 10:37:05 +0000 (11:37 +0100)
modules.d/98systemd/module-setup.sh

index 443481a3b62dccc8bb12643dcb41a97e1d3ea821..6b00be511f21b5a5faa51115c93f1de014707961 100755 (executable)
@@ -16,6 +16,7 @@ depends() {
 }
 
 install() {
+    local _mods
 
     SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
     if (( $SYSTEMD_VERSION < 198 )); then
@@ -109,6 +110,26 @@ install() {
     dracut_install -o \
         /usr/lib/modules-load.d/*.conf
 
+    modules_load_get() {
+        local _line i
+        for i in "$1"/*.conf; do
+            [[ -f $i ]] || continue
+            while read _line; do
+                case $_line in
+                    \#*)
+                        ;;
+                    \;*)
+                        ;;
+                    *)
+                        echo $_line
+                esac
+            done < "$i"
+        done
+    }
+
+    _mods=$(modules_load_get /usr/lib/modules-load.d)
+    [[ $_mods ]] && instmods $_mods
+
     if [[ $hostonly ]]; then
         dracut_install -o \
             /etc/systemd/journald.conf \
@@ -120,6 +141,8 @@ install() {
 
         dracut_install -o \
             /etc/modules-load.d/*.conf
+        _mods=$(modules_load_get /etc/modules-load.d)
+        [[ $_mods ]] && instmods $_mods
     else
         if ! [[ -e "$initdir/etc/machine-id" ]]; then
             > "$initdir/etc/machine-id"