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