Blame 0168-dracut.sh-remove-the-concept-of-host_modalias.patch

Harald Hoyer bb31e7
From 07a081f352497258862ae164d11d9e6dc2c5b959 Mon Sep 17 00:00:00 2001
Harald Hoyer bb31e7
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer bb31e7
Date: Fri, 13 Nov 2015 13:40:38 +0100
Harald Hoyer bb31e7
Subject: [PATCH] dracut.sh: remove the concept of host_modalias
Harald Hoyer bb31e7
Harald Hoyer bb31e7
We can never gather enough information about compiled in modules, so
Harald Hoyer bb31e7
don't pretend to know and do smart decisions.
Harald Hoyer bb31e7
---
Harald Hoyer bb31e7
 dracut-init.sh | 14 ++------------
Harald Hoyer bb31e7
 dracut.sh      | 22 +---------------------
Harald Hoyer bb31e7
 2 files changed, 3 insertions(+), 33 deletions(-)
Harald Hoyer bb31e7
Harald Hoyer bb31e7
diff --git a/dracut-init.sh b/dracut-init.sh
Harald Hoyer bb31e7
index d254e76..f22256c 100644
Harald Hoyer bb31e7
--- a/dracut-init.sh
Harald Hoyer bb31e7
+++ b/dracut-init.sh
Harald Hoyer bb31e7
@@ -1022,18 +1022,8 @@ module_is_host_only() {
Harald Hoyer bb31e7
             modinfo -F filename "$_mod" &>/dev/null && return 1
Harald Hoyer bb31e7
         fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
-        _aliases=$(modinfo -k $kernel -F alias $_mod 2>/dev/null)
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
-        # if the module has no aliases, install it
Harald Hoyer bb31e7
-        [[ $_aliases ]] || return 0
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
-        # finally check all modalias
Harald Hoyer bb31e7
-        for a in $_aliases; do
Harald Hoyer bb31e7
-            for i in "${!host_modalias[@]}"; do
Harald Hoyer bb31e7
-                [[ $i == $a ]]  && return 0
Harald Hoyer bb31e7
-            done
Harald Hoyer bb31e7
-        done
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
+        # just install the module, better safe than sorry
Harald Hoyer bb31e7
+        return 0
Harald Hoyer bb31e7
     fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
     return 1
Harald Hoyer bb31e7
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer bb31e7
index 52a628a..a21295d 100755
Harald Hoyer bb31e7
--- a/dracut.sh
Harald Hoyer bb31e7
+++ b/dracut.sh
Harald Hoyer bb31e7
@@ -1187,26 +1187,6 @@ if [[ $hostonly ]]; then
Harald Hoyer bb31e7
             fi
Harald Hoyer bb31e7
         done < /etc/fstab
Harald Hoyer bb31e7
     fi
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
-    # record all host modaliases
Harald Hoyer bb31e7
-    declare -A host_modalias
Harald Hoyer bb31e7
-    find /sys/devices -name modalias -exec cat '{}' \; > "$initdir/.modalias"
Harald Hoyer bb31e7
-    while read -r modalias || [ -n "$modalias" ]; do
Harald Hoyer bb31e7
-        [[ $modalias ]] && host_modalias["$modalias"]=1
Harald Hoyer bb31e7
-    done < "$initdir/.modalias"
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
-    rm -f -- "$initdir/.modalias"
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
-    while read _k _s _v || [ -n "$_k" ]; do
Harald Hoyer bb31e7
-        [ "$_k" != "name" -a "$_k" != "driver" ] && continue
Harald Hoyer bb31e7
-        host_modalias["$_v"]=1
Harald Hoyer bb31e7
-    done 
Harald Hoyer bb31e7
-
Harald Hoyer bb31e7
-    # check /proc/modules
Harald Hoyer bb31e7
-    declare -A host_modules
Harald Hoyer bb31e7
-    while read m rest || [ -n "$m" ]; do
Harald Hoyer bb31e7
-        host_modules["$m"]=1
Harald Hoyer bb31e7
-    done 
Harald Hoyer bb31e7
 fi
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 unset m
Harald Hoyer bb31e7
@@ -1293,7 +1273,7 @@ export initdir dracutbasedir \
Harald Hoyer bb31e7
     debug host_fs_types host_devs swap_devs sshkey add_fstab \
Harald Hoyer bb31e7
     DRACUT_VERSION udevdir prefix filesystems drivers \
Harald Hoyer bb31e7
     systemdutildir systemdsystemunitdir systemdsystemconfdir \
Harald Hoyer bb31e7
-    host_modalias host_modules hostonly_cmdline loginstall \
Harald Hoyer bb31e7
+    host_modules hostonly_cmdline loginstall \
Harald Hoyer bb31e7
     tmpfilesdir
Harald Hoyer bb31e7
 
Harald Hoyer bb31e7
 mods_to_load=""