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 <[email protected]>
---
 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

Attachment: signature.asc
Description: Digital signature

Reply via email to