[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH initramfs-tools 3/5] scripts/local: Add option for local_device_setup to return failure



If the root or /usr filesystem is missing, we cannot continue
booting and must panic.  This is not true for the resume device,
and a missing resume device has not been a fatal error up until
now.

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

diff --git a/scripts/local b/scripts/local
index 54ac0ad5c3b4..c78891003565 100644
--- a/scripts/local
+++ b/scripts/local
@@ -40,11 +40,13 @@ local_bottom()
 
 # $1=device ID to mount
 # $2=optionname (for root and etc)
+# $3=panic if device is missing (true or false, default: true)
 # Sets $DEV to the resolved device node
 local_device_setup()
 {
 	local dev_id="$1"
 	local name="$2"
+	local may_panic="${3:-true}"
 	local real_dev
 	local uptime
 
@@ -101,6 +103,10 @@ local_device_setup()
 	# We've given up, but we'll let the user fix matters if they can
 	while ! real_dev=$(resolve_device "${dev_id}") ||
 	      ! get_fstype "${real_dev}" >/dev/null; do
+		if ! $may_panic; then
+			echo "Gave up waiting for ${name}"
+			return 1
+		fi
 		echo "Gave up waiting for ${name} device.  Common problems:"
 		echo " - Boot args (cat /proc/cmdline)"
 		echo "   - Check rootdelay= (did the system wait long enough?)"

Attachment: signature.asc
Description: Digital signature


Reply to: