File: remove-wait-for-root.patch

package info (click to toggle)
cloud-initramfs-tools 0.18.debian8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 240 kB
  • sloc: sh: 852; makefile: 33
file content (41 lines) | stat: -rw-r--r-- 1,311 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Description: remove wait for root in overlayroot init-bottom
Author: Julien Danjou <acid@debian.org>
Forwarded: no
Date: 2013-01-29

--- a/growroot/scripts/local-bottom/growroot
+++ b/growroot/scripts/local-bottom/growroot
@@ -88,7 +88,11 @@
 
 # this is taken from 'mountroot' function
 #   see /usr/share/initramfs-tools/scripts/local
-FSTYPE=$(wait-for-root "${ROOT}" ${ROOTDELAY:-30})
+if [ -z "${ROOTFSTYPE}" ]; then
+    FSTYPE=$(get_fstype "${ROOT}")
+else
+    FSTYPE=${ROOTFSTYPE}
+fi
 roflag="-r"
 [ "${readonly}" = "y" ] || roflag="-w"
 mount ${roflag} ${FSTYPE:+-t ${FSTYPE} }${ROOTFLAGS} ${ROOT} ${rootmnt} ||
--- a/overlayroot/scripts/init-bottom/overlayroot
+++ b/overlayroot/scripts/init-bottom/overlayroot
@@ -137,8 +137,16 @@
 	local dev="$1" timeout="${2:-0}"
 	[ -b "$dev" ] && return 0
 	[ "$timeout" = "0" ] && return 1
-	# wait-for-root writes fstype to stdout, redirect to null
-	wait-for-root "$dev" "$timeout" >/dev/null
+        timeout=$(( ${timeout} * 10 ))
+        while [ ! -e "$dev" ]; do
+            /bin/sleep 0.1
+            timeout=$(( ${timeout} - 1 ))
+            [ ${timeout} -gt 0 ] || break
+        done
+	if [ ${timeout} -gt 0 ]; then
+	    return 0
+        fi
+        return 1
 }
 crypto_setup() {
 	local fstype="ext4" pass="" mapname="secure" mkfs="1" dev=""