[projects/geninitrd] don't fail if root device cannot be determined

atler atler at pld-linux.org
Tue Nov 2 01:50:17 CET 2021


commit 95afa3ecf50575a1bc44cf0510c3b96878418f71
Author: Jan Palus <atler at pld-linux.org>
Date:   Mon Nov 1 22:46:34 2021 +0100

    don't fail if root device cannot be determined
    
    useful when creating generic images on loop device (/dev not mounted,
    root referenced by either LABEL or UUID, required modules added manually)

 functions | 3 +--
 geninitrd | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/functions b/functions
index 3a52190..186b967 100644
--- a/functions
+++ b/functions
@@ -109,8 +109,7 @@ find_root() {
 	fi
 
 	if [ ! -r "$rootdev" ]; then
-		echo >&2 "$function: rootfs device file $rootdev doesn't exist"
-		return 1
+		echo >&2 "WARNING: $function: rootfs device file $rootdev doesn't exist"
 	fi
 
 	return 0
diff --git a/geninitrd b/geninitrd
index 8baaffa..2cb8d34 100755
--- a/geninitrd
+++ b/geninitrd
@@ -952,7 +952,7 @@ initrd_gen_initramfs_switchroot() {
 	if [ "$rootdev" = "/dev/nfs" ]; then
 		echo "rootfs on NFS root=/dev/nfs"
 	else
-		[ ! -e "$DESTDIR/$rootdev" ] && inst $rootdev $rootdev
+		[ -e $rootdev ] && [ ! -e "$DESTDIR/$rootdev" ] && inst $rootdev $rootdev
 	fi
 
 	# parse 'root=xxx' kernel commandline
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/geninitrd.git/commitdiff/95afa3ecf50575a1bc44cf0510c3b96878418f71



More information about the pld-cvs-commit mailing list