SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Thu Oct 4 17:24:19 CEST 2007


Author: glen
Date: Thu Oct  4 17:24:19 2007
New Revision: 8777

Modified:
   geninitrd/trunk/geninitrd
Log:
- make initrd_gen_tmpfs_dev() callable multiple times

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Thu Oct  4 17:24:19 2007
@@ -1078,11 +1078,20 @@
 EOF
 }
 
+# generate code to mount /dev on tmpfs and create initial nodes
+# can be called multiple times. /dev is cleaned up automatically at the end of
+# script.
 initrd_gen_tmpfs_dev() {
     if [ "$INITRDFS" = "initramfs" ]; then
 		# initramfs is read-write filesystem, no need for tmpfs
 		return
 	fi
+
+	# we already generated tmpfs code; return
+	if is_yes "$tmpfs_dev"; then
+		return
+	fi
+
 	tmpfs_dev=yes
 
 	busybox_applet mount mknod mkdir
@@ -1118,14 +1127,14 @@
 			mount -t sysfs none /sys
 			: 'Starting udev'
 			/sbin/udevd --daemon
-			EOF
+		EOF
 		if is_yes "$PROBESTATICMODS"; then
 			inst /sbin/initrd-udevtrigger $MNTIMAGE/sbin/udevtrigger
 			inst /sbin/initrd-udevsettle $MNTIMAGE/sbin/udevsettle
-			cat >> "$s" <<- 'EOF'
+			cat >> "$s" <<-'EOF'
 				/sbin/udevtrigger
 				/sbin/udevsettle
-				EOF
+			EOF
 		fi
 
 		busybox_applet killall
@@ -1133,7 +1142,7 @@
 			killall udevd
 			umount /proc
 			umount /sys
-			EOF
+		EOF
 	fi
 }
 
@@ -1143,9 +1152,7 @@
 	fi
 
 	# always make /dev on tmpfs
-	if ! is_yes "$tmpfs_dev"; then
-		initrd_gen_tmpfs_dev
-	fi
+	initrd_gen_tmpfs_dev
 
 	mkdir -p "$MNTIMAGE/sbin"
 	inst /sbin/dmraid-initrd $MNTIMAGE/sbin/dmraid
@@ -1268,7 +1275,7 @@
 	mkdir -p $MNTIMAGE/newroot
 
 	# always make /dev on tmpfs for LVM2
-	if [ "$LVMTOOLSVERSION" = "2" ] && ! is_yes "$tmpfs_dev"; then
+	if [ "$LVMTOOLSVERSION" = "2" ]; then
 		initrd_gen_tmpfs_dev
 	fi
 


More information about the pld-cvs-commit mailing list