SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Fri May 31 01:14:32 CEST 2013


Author: glen
Date: Fri May 31 01:14:32 2013
New Revision: 12685

Modified:
   geninitrd/trunk/geninitrd
Log:
umount_all: try to move pseudo filesystems to newroot if possible

thus preserving the mounts


Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Fri May 31 01:14:32 2013
@@ -241,6 +241,7 @@
 }
 
 # unmount all mountpoints mounted by geninitrd
+# try to move pseudo filesystems to newroot if possible
 umount_all() {
 
 	add_linuxrc <<-'EOF'
@@ -249,29 +250,39 @@
 	EOF
 
 	if is_yes "$run_mounted"; then
-		echo 'mount --bind /run /newroot/run' | add_linuxrc
-		echo 'umount /run' | add_linuxrc
+		add_linuxrc <<-EOF
+		mount --bind /run /newroot/run
+		umount /run
+		EOF
 		run_mounted=no
 	fi
 	if is_yes "$dev_mounted"; then
-		echo 'umount /dev' | add_linuxrc
+		add_linuxrc <<-EOF
+		mount --bind /dev /newroot/dev
+		umount /dev
+		EOF
 		dev_mounted=no
 	fi
 	if is_yes "$sys_mounted"; then
-		echo 'umount /sys' | add_linuxrc
+		add_linuxrc <<-EOF
+		mount --bind /sys /newroot/sys
+		umount /sys
+		EOF
 		sys_mounted=no
 	fi
+	if is_yes "$proc_mounted"; then
+		add_linuxrc <<-EOF
+		mount --bind /proc /newroot/proc
+		umount /proc
+		EOF
+		proc_mounted=no
+	fi
 	if is_yes "$tmp_mounted"; then
 		echo 'umount /tmp' | add_linuxrc
 		tmp_mounted=no
 	fi
-	if is_yes "$proc_mounted"; then
-		echo 'umount /proc' | add_linuxrc
-		proc_mounted=no
-	fi
 }
 
-
 # Checks if busybox has support for APPLET(s)
 # Exits from geninitrd if the support is not present.
 #


More information about the pld-cvs-commit mailing list