[readonly/geninitrd/devel: 237/334] Convert generation of nfs/softraid/lvm/suspend stuff into functions (initrd_gen_XXX).

draenog draenog at pld-linux.org
Sat Nov 2 19:31:27 CET 2013


commit 2df2e995b9f2491d6694968c80d56fa7dc593014
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Sep 16 12:45:56 2004 +0000

    Convert generation of nfs/softraid/lvm/suspend stuff into functions (initrd_gen_XXX).
    
    svn-id: @4599

 geninitrd | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 60e7713..a0ce1ad 100755
--- a/geninitrd
+++ b/geninitrd
@@ -1018,7 +1018,7 @@ modules_add_linuxrc "$MODULES" "$s"
 #	echo "losetup $rootdev1 /loopfs$loopFile" >> "$RCFILE"
 #fi
 
-if is_yes "$USESUSPEND"; then
+initrd_gen_suspend() {
 	MODULES=""
 	for mod in $SUSPENDMODS; do
 	    is_yes "$BOOT_SPLASH" && [ "$mod" = "-suspend-text" ] && mod="-suspend_bootsplash"
@@ -1036,9 +1036,9 @@ if is_yes "$USESUSPEND"; then
 	echo "	exit 0" >> "$s"
 	echo "fi" >> "$s"
 	echo "umount /proc" >> "$s"
-fi
+}
 
-if is_yes "$USERAIDSTART" && is_yes "$raidfound" ; then
+initrd_gen_softraid() {
 	[ -n "$verbose" ] && echo "Setting up mdadm..."
 	
 	if [ ! -x /sbin/initrd-mdadm -a ! -x /sbin/initrd-mdassemble ] ; then
@@ -1088,9 +1088,9 @@ if is_yes "$USERAIDSTART" && is_yes "$raidfound" ; then
 	if [ "$do_md0" -eq 1 ] ; then
 		mknod $MNTIMAGE/dev/md0 b 9 0
 	fi
-fi
+}
 
-if is_yes "$usenfs" ; then
+initrd_gen_nfs() {
     	# use root=/dev/ram0 init=/linuxrc when starting kernel or you will
 	# have problems like init(XX) being child process of swapper(1).
     	[ -n "$verbose" ] && echo "Adding rootfs on NFS support to initrd (dhcp)"
@@ -1132,9 +1132,9 @@ EOF
 	echo "pivot_root . initrd" >> "$s"
 	echo "[ -x /sbin/chroot ] && exec /sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
 	echo "exec /usr/sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
-fi
+}
 
-if is_yes "$uselvm" ; then
+initrd_gen_lvm() {
 	[ -n "$verbose" ] && echo "Adding LVM support to initrd"
 	inst /sbin/initrd-lvm $MNTIMAGE/bin/lvm
 	mkdir -p $MNTIMAGE/etc
@@ -1184,6 +1184,22 @@ if is_yes "$uselvm" ; then
 #	        echo "[ -x /sbin/chroot ] && exec /sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
 #		echo "exec /usr/sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$s"
 	fi
+}
+
+# main generation
+if is_yes "$USESUSPEND"; then
+	initrd_gen_suspend
+fi
+
+if is_yes "$usenfs" ; then
+	initrd_gen_nfs
+elif is_yes "$USERAIDSTART" && is_yes "$raidfound" ; then
+	initrd_gen_softraid
+	if is_yes "$uselvm" ; then
+		initrd_gen_lvm
+	fi
+elif is_yes "$uselvm" ; then
+	initrd_gen_lvm
 fi
 
 chmod +x "$RCFILE"
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/398807324938659207036e520c0950a61ef50c11



More information about the pld-cvs-commit mailing list