[PATCH initramfs-tools 2/5] scripts/local: Apply a single time limit to all device discovery

Ben Hutchings ben at decadent.org.uk
Sun Feb 19 01:36:09 UTC 2017


Instead of counting how many times we wait and poll for each critical
device (root or /usr) to appear, use /proc/uptime to tell how long we
have waited in total.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
 scripts/local | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/local b/scripts/local
index a4ddcea73a38..54ac0ad5c3b4 100644
--- a/scripts/local
+++ b/scripts/local
@@ -46,6 +46,7 @@ local_device_setup()
 	local dev_id="$1"
 	local name="$2"
 	local real_dev
+	local uptime
 
 	wait_for_udev 10
 
@@ -88,8 +89,9 @@ local_device_setup()
 				log_end_msg 0
 				break
 			fi
-			slumber=$(( ${slumber} - 1 ))
-			if [ ${slumber} -eq 0 ]; then
+			uptime="$(cat /proc/uptime)"
+			uptime="${uptime%%[. ]*}"
+			if [ ${uptime} -ge ${slumber} ]; then
 				log_end_msg 1 || true
 				break
 			fi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-mdadm-devel/attachments/20170219/66114d1f/attachment.sig>


More information about the pkg-mdadm-devel mailing list