Blame 0052-dracut.sh-simplify-modalias-reading.patch

Harald Hoyer 368a0c
From 96d694c0b5949586dad8eab5491ad41521eec514 Mon Sep 17 00:00:00 2001
Harald Hoyer 368a0c
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer 368a0c
Date: Thu, 30 Jul 2015 12:11:42 +0200
Harald Hoyer 368a0c
Subject: [PATCH] dracut.sh: simplify modalias reading
Harald Hoyer 368a0c
Harald Hoyer 368a0c
---
Harald Hoyer 368a0c
 dracut.sh | 10 +++-------
Harald Hoyer 368a0c
 1 file changed, 3 insertions(+), 7 deletions(-)
Harald Hoyer 368a0c
Harald Hoyer 368a0c
diff --git a/dracut.sh b/dracut.sh
Harald Hoyer 368a0c
index 27be54a..77874ba 100755
Harald Hoyer 368a0c
--- a/dracut.sh
Harald Hoyer 368a0c
+++ b/dracut.sh
Harald Hoyer 368a0c
@@ -1179,13 +1179,9 @@ if [[ $hostonly ]]; then
Harald Hoyer 368a0c
 
Harald Hoyer 368a0c
     # record all host modaliases
Harald Hoyer 368a0c
     declare -A host_modalias
Harald Hoyer 368a0c
-    find  /sys/devices/ -name uevent -print > "$initdir/.modalias"
Harald Hoyer 368a0c
-    while read m || [ -n "$m" ]; do
Harald Hoyer 368a0c
-        while read line || [ -n "$line" ]; do
Harald Hoyer 368a0c
-            [[ "$line" != MODALIAS\=* ]] && continue
Harald Hoyer 368a0c
-            modalias="${line##MODALIAS=}" && [[ $modalias ]] && host_modalias["$modalias"]=1
Harald Hoyer 368a0c
-            break
Harald Hoyer 368a0c
-        done < "$m"
Harald Hoyer 368a0c
+    find /sys/devices -name modalias -exec cat '{}' \; > "$initdir/.modalias"
Harald Hoyer 368a0c
+    while read -r modalias || [ -n "$modalias" ]; do
Harald Hoyer 368a0c
+        [[ $modalias ]] && host_modalias["$modalias"]=1
Harald Hoyer 368a0c
     done < "$initdir/.modalias"
Harald Hoyer 368a0c
 
Harald Hoyer 368a0c
     rm -f -- "$initdir/.modalias"