dracut/0005-base-dracut-lib.sh-wait_for_dev-cancel_wait_for_dev-.patch
Harald Hoyer 38a2ddf58a dracut-027-10.git20130405
- fix crypto password timeout on the dracut side
2013-04-05 12:05:17 +02:00

112 lines
3.7 KiB
Diff

From 6db8c5a5fe5b77de757e7b669c8277cd2dafaf8e Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Thu, 4 Apr 2013 12:56:42 +0200
Subject: [PATCH] base/dracut-lib.sh:wait_for_dev()/cancel_wait_for_dev() set
systemd timeouts
Set systemd unit timeouts for the devices we wait for. The systemd
default is 90 seconds, which is way too low for complicated setups.
---
modules.d/99base/dracut-lib.sh | 15 ++++++++++++++-
modules.d/99base/module-setup.sh | 14 +++++++-------
modules.d/99base/wait-host-devs.sh | 20 --------------------
3 files changed, 21 insertions(+), 28 deletions(-)
delete mode 100644 modules.d/99base/wait-host-devs.sh
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index 79fc953..f2b16d3 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -849,6 +849,13 @@ wait_for_dev()
[ -d ${PREFIX}/etc/systemd/system/initrd.target.requires ] || mkdir -p ${PREFIX}/etc/systemd/system/initrd.target.requires
ln -s ../${_name}.device ${PREFIX}/etc/systemd/system/initrd.target.requires/${_name}.device
fi
+
+ mkdir -p ${PREFIX}/etc/systemd/system/${_name}.device.d
+ {
+ echo "[Unit]"
+ echo "JobTimeoutSec=3600"
+ } > ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
+ [ -z "$PREFIX" ] && /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload
fi
}
@@ -858,6 +865,12 @@ cancel_wait_for_dev()
_name="$(str_replace "$1" '/' '\\x2f')"
rm -f "$hookdir/initqueue/finished/devexists-${_name}.sh"
rm -f "$hookdir/emergency/80-${_name}.sh"
+ if [ -n "$DRACUT_SYSTEMD" ]; then
+ _name=$(dev_unit_name "$1")
+ rm -f ${PREFIX}/etc/systemd/system/initrd.target.requires/${_name}.device
+ rm -f ${PREFIX}/etc/systemd/system/${_name}.device.d/timeout.conf
+ /sbin/initqueue --onetime --unique --name daemon-reload systemctl daemon-reload
+ fi
}
killproc() {
@@ -1023,7 +1036,7 @@ listlist() {
# returns OK if both lists contain the same values. An order and a duplication
# doesn't matter.
-#
+#
# $1 = separator
# $2 = list1
# $3 = list2
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
index 7f2940b..4955b7b 100755
--- a/modules.d/99base/module-setup.sh
+++ b/modules.d/99base/module-setup.sh
@@ -89,18 +89,18 @@ install() {
## save host_devs which we need bring up
(
+ if dracut_module_included "systemd"; then
+ DRACUT_SYSTEMD=1
+ fi
+ PREFIX="$initdir"
+
. "$moddir/dracut-lib.sh"
+
for _dev in ${host_devs[@]}; do
_pdev=$(get_persistent_dev $_dev)
case "$_pdev" in
- /dev/?*)
- if ! dracut_module_included "systemd"; then
- PREFIX="$initdir" wait_for_dev $_pdev
- else
- DRACUT_SYSTEMD=1 PREFIX="$initdir" wait_for_dev $_pdev
- fi
- ;;
+ /dev/?*) wait_for_dev $_pdev;;
*) ;;
esac
done
diff --git a/modules.d/99base/wait-host-devs.sh b/modules.d/99base/wait-host-devs.sh
deleted file mode 100644
index ce84922..0000000
--- a/modules.d/99base/wait-host-devs.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-
-type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
-
-wait_host_devs() {
- local _dev
-
- while read _dev; do
- case "$_dev" in
- /dev/?*)
- wait_for_dev $_dev
- ;;
- *) ;;
- esac
- done < $1
-}
-
-[ -f /etc/host_devs ] && wait_host_devs /etc/host_devs