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