[readonly/geninitrd/devel: 217/334] Mount LVM2 rootfs read-only; few cleanups.

draenog draenog at pld-linux.org
Sat Nov 2 19:29:46 CET 2013


commit d4a8e40e43633932719ed94cf9f9392d143ceb7c
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Jun 24 15:09:02 2004 +0000

    Mount LVM2 rootfs read-only; few cleanups.
    
    svn-id: @4241

 geninitrd | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 32b74b6..a6daaef 100755
--- a/geninitrd
+++ b/geninitrd
@@ -1076,7 +1076,7 @@ EOF
 	chmod 755 "$MNTIMAGE/bin/setdhcp"
 	echo "cd /newroot" >> "$s"
 	echo "pivot_root . initrd" >> "$s"
-	echo "exec /sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$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
 
@@ -1112,14 +1112,13 @@ if is_yes "$uselvm" ; then
 		echo "}" >> "$MNTIMAGE/etc/lvm.conf"
 		echo "LVM_SYSTEM_DIR=/tmp lvm vgscan --ignorelockingfailure" >> "$s"
 		echo "LVM_SYSTEM_DIR=/tmp lvm vgchange --ignorelockingfailure -a y $VGVOLUME" >> "$s"
-		echo "mount $org_rootdev /newroot" >> "$s"
+		echo "mount -n -o ro $org_rootdev /newroot" >> "$s"
 		echo "umount /tmp" >> "$s"
-		# fail to umount
 		echo "umount /dev" >> "$s"
 		echo "umount /proc" >> "$s"
 	        echo "cd /newroot" >> "$s"
 	        echo "pivot_root . initrd" >> "$s"
-	        echo "exec /sbin/chroot . /sbin/init -i < dev/console > dev/console 2>&1" >> "$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
 fi
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list