64b87c
From 1ad2884d82f15e9d1a6f3e24da42d56f47ebe949 Mon Sep 17 00:00:00 2001
64b87c
From: Harald Hoyer <harald@redhat.com>
64b87c
Date: Tue, 16 Jun 2015 13:28:48 +0200
64b87c
Subject: [PATCH] dracut-pre-pivot: call udevadm settle one last time
64b87c
64b87c
Some Hardware needs initialization and killing modprobe or modprobe
64b87c
scripts would harm the process.
64b87c
---
64b87c
 modules.d/98systemd/dracut-pre-pivot.service |  7 -------
64b87c
 modules.d/98systemd/dracut-pre-pivot.sh      | 12 ++++++++++++
64b87c
 2 files changed, 12 insertions(+), 7 deletions(-)
64b87c
64b87c
diff --git a/modules.d/98systemd/dracut-pre-pivot.service b/modules.d/98systemd/dracut-pre-pivot.service
1755ca
index d7c7b1d7..f4539006 100644
64b87c
--- a/modules.d/98systemd/dracut-pre-pivot.service
64b87c
+++ b/modules.d/98systemd/dracut-pre-pivot.service
64b87c
@@ -16,13 +16,6 @@ Before=initrd-cleanup.service
64b87c
 Wants=remote-fs.target
64b87c
 After=remote-fs.target
64b87c
 ConditionPathExists=/etc/initrd-release
64b87c
-ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot
64b87c
-ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cleanup
64b87c
-ConditionKernelCommandLine=|rd.break=pre-pivot
64b87c
-ConditionKernelCommandLine=|rd.break=cleanup
64b87c
-ConditionKernelCommandLine=|rd.break
64b87c
-ConditionPathExists=|/dev/root
64b87c
-ConditionPathExists=|/dev/nfs
64b87c
 
64b87c
 [Service]
64b87c
 Environment=DRACUT_SYSTEMD=1
64b87c
diff --git a/modules.d/98systemd/dracut-pre-pivot.sh b/modules.d/98systemd/dracut-pre-pivot.sh
1755ca
index e62a1cec..afe34668 100755
64b87c
--- a/modules.d/98systemd/dracut-pre-pivot.sh
64b87c
+++ b/modules.d/98systemd/dracut-pre-pivot.sh
64b87c
@@ -26,4 +26,16 @@ getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switc
64b87c
 [ -h /dev/root ] && rm -f -- /dev/root
64b87c
 [ -h /dev/nfs ] && rm -f -- /dev/nfs
64b87c
 
64b87c
+udevadm settle
64b87c
+
64b87c
+cnt=0
64b87c
+while ! udevadm settle --timeout=0; do
64b87c
+    info "udev still not settled. Waiting."
64b87c
+    udevadm settle
64b87c
+    cnt=$(($cnt+1))
64b87c
+    [ $cnt -gt 10 ] && break
64b87c
+done
64b87c
+
64b87c
+udevadm control --exit
64b87c
+
64b87c
 exit 0