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