Blob Blame History Raw
From ca46c751d1becbbff68c561bfbc9ee36182fcc38 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 30 Jun 2016 15:24:54 +0200
Subject: [PATCH] add rd.device.timeout=<seconds> parameter

---
 modules.d/98systemd/rootfs-generator.sh | 4 +++-
 modules.d/99base/dracut-lib.sh          | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh
index 2c098951..a7bffdfd 100755
--- a/modules.d/98systemd/rootfs-generator.sh
+++ b/modules.d/98systemd/rootfs-generator.sh
@@ -7,6 +7,7 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
 generator_wait_for_dev()
 {
     local _name
+    local _timeout
 
     _name="$(str_replace "$1" '/' '\x2f')"
 
@@ -26,10 +27,11 @@ generator_wait_for_dev()
     fi
 
     if ! [ -f /run/systemd/generator/${_name}.device.d/timeout.conf ]; then
+        _timeout=$(getarg rd.device.timeout || printf "0")
         mkdir -p /run/systemd/generator/${_name}.device.d
         {
             echo "[Unit]"
-            echo "JobTimeoutSec=0"
+            echo "JobTimeoutSec=$_timeout"
         } > /run/systemd/generator/${_name}.device.d/timeout.conf
     fi
 }
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index c2b6108a..16bc74d4 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -887,6 +887,7 @@ wait_for_dev()
     local _name
     local _needreload
     local _noreload
+    local _timeout
 
     if [ "$1" = "-n" ]; then
         _noreload=1
@@ -913,10 +914,11 @@ wait_for_dev()
         fi
 
         if ! [ -f ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf ]; then
+            _timeout=$(getarg rd.device.timeout || printf "0")
             mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d
             {
                 echo "[Unit]"
-                echo "JobTimeoutSec=0"
+                echo "JobTimeoutSec=$_timeout"
             } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
             _needreload=1
         fi