712866
From ca46c751d1becbbff68c561bfbc9ee36182fcc38 Mon Sep 17 00:00:00 2001
712866
From: Harald Hoyer <harald@redhat.com>
712866
Date: Thu, 30 Jun 2016 15:24:54 +0200
712866
Subject: [PATCH] add rd.device.timeout=<seconds> parameter
712866
712866
---
712866
 modules.d/98systemd/rootfs-generator.sh | 4 +++-
712866
 modules.d/99base/dracut-lib.sh          | 4 +++-
712866
 2 files changed, 6 insertions(+), 2 deletions(-)
712866
712866
diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh
5c6c2a
index 2c098951..a7bffdfd 100755
712866
--- a/modules.d/98systemd/rootfs-generator.sh
712866
+++ b/modules.d/98systemd/rootfs-generator.sh
712866
@@ -7,6 +7,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
712866
 generator_wait_for_dev()
712866
 {
712866
     local _name
712866
+    local _timeout
712866
 
712866
     _name="$(str_replace "$1" '/' '\x2f')"
712866
 
712866
@@ -26,10 +27,11 @@ generator_wait_for_dev()
712866
     fi
712866
 
712866
     if ! [ -f /run/systemd/generator/${_name}.device.d/timeout.conf ]; then
712866
+        _timeout=$(getarg rd.device.timeout || printf "0")
712866
         mkdir -p /run/systemd/generator/${_name}.device.d
712866
         {
712866
             echo "[Unit]"
712866
-            echo "JobTimeoutSec=0"
712866
+            echo "JobTimeoutSec=$_timeout"
712866
         } > /run/systemd/generator/${_name}.device.d/timeout.conf
712866
     fi
712866
 }
712866
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
5c6c2a
index c2b6108a..16bc74d4 100755
712866
--- a/modules.d/99base/dracut-lib.sh
712866
+++ b/modules.d/99base/dracut-lib.sh
712866
@@ -887,6 +887,7 @@ wait_for_dev()
712866
     local _name
712866
     local _needreload
712866
     local _noreload
712866
+    local _timeout
712866
 
712866
     if [ "$1" = "-n" ]; then
712866
         _noreload=1
712866
@@ -913,10 +914,11 @@ wait_for_dev()
712866
         fi
712866
 
712866
         if ! [ -f ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf ]; then
712866
+            _timeout=$(getarg rd.device.timeout || printf "0")
712866
             mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d
712866
             {
712866
                 echo "[Unit]"
712866
-                echo "JobTimeoutSec=0"
712866
+                echo "JobTimeoutSec=$_timeout"
712866
             } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
712866
             _needreload=1
712866
         fi