[readonly/geninitrd: 504/1068] - create /proc, /sys, /etc only once

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


commit 58353d6d326e16f02acf0b2f63c7c944da9e756f
Author: Adam Gołębiowski <adamg at pld-linux.org>
Date:   Sat Nov 3 14:34:33 2007 +0000

    - create /proc, /sys, /etc only once
    
    svn-id: @8980

 geninitrd | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index a4d26ca..01b25d5 100755
--- a/geninitrd
+++ b/geninitrd
@@ -908,8 +908,6 @@ firmware_install_module() {
 	local firmware_files="$2"
 
 	debug "Adding Firmwares ($firmware_files) to initrd for module $module"
-	inst_d /proc
-	inst_d /sys
 	# firmware not yet installed
 	if [ ! -f "$MNTIMAGE/lib/firmware/firmware.sh" ]; then
 		inst_d /lib/firmware
@@ -1309,7 +1307,8 @@ rm -rf "$MNTPOINT"/lost+found
 chmod a+rx "$RCFILE"
 ln -s linuxrc $MNTIMAGE/init
 
-inst_d /{lib,bin,etc,dev,loopfs,var}
+# create dirs that we really need
+inst_d /{lib,bin,etc,dev{,/pts,/shm},loopfs,var,proc,sys}
 
 modules_install "$MODULES"
 
@@ -1318,7 +1317,6 @@ modules_install "$MODULES"
 mknod "$MNTIMAGE/dev/console" c 5 1
 mknod "$MNTIMAGE/dev/null" c 1 3
 mknod "$MNTIMAGE/dev/zero" c 1 5
-inst_d /dev/pts /dev/shm
 
 inst /bin/initrd-busybox /bin/initrd-busybox
 ln -s initrd-busybox $MNTIMAGE/bin/sh
@@ -1383,7 +1381,6 @@ initrd_gen_suspend() {
 	if [ ! -x /usr/${_lib}/suspend/resume -a ! -x /usr/sbin/resume ]; then
 		die "/usr/${_lib}/suspend/resume is missing!"
 	fi
-	inst_d /etc /dev
 	resume_dev="$(awk '/^resume device =/ { print $4 } ' /etc/suspend.conf)"
 	mknod $MNTIMAGE/dev/snapshot c 10 231
 	inst $resume_dev /dev
@@ -1397,7 +1394,6 @@ initrd_gen_suspend() {
 }
 
 initrd_gen_tuxonice() {
-	inst_d /sys /proc
 	mount_sys
 	add_linuxrc <<-'EOF'
 		if [ "$(echo "$CMDLINE" | awk ' /resume2=/  { print "yes"; } ' /proc/cmdline)" = "yes" ]; then
@@ -1410,7 +1406,7 @@ initrd_gen_tuxonice() {
 
 initrd_gen_udev() {
 	debug "Setting up udev..."
-	inst_d /sbin /proc /etc/udev /sys
+	inst_d /sbin /etc/udev
 
 	if [ ! -x /sbin/initrd-udevd ]; then
 		die "/sbin/initrd-udevd not present"
@@ -1441,7 +1437,7 @@ initrd_gen_udev() {
 }
 
 initrd_gen_multipath() {
-	inst_d /proc /sys /sbin /lib/udev /etc
+	inst_d /sbin /lib/udev
 	inst_exec /sbin/kpartx /sbin
 	inst_exec /sbin/multipath /sbin
 	# for udev callouts
@@ -1475,7 +1471,7 @@ initrd_gen_dmraid() {
 		die "/sbin/dmraid-initrd is missing!"
 	fi
 
-	inst_d /sbin /sys
+	inst_d /sbin
 	inst /sbin/dmraid-initrd /sbin/dmraid
 
 	mount_dev
@@ -1669,7 +1665,7 @@ initrd_gen_nfs() {
 
 initrd_gen_lvm() {
 	debug "Adding LVM support to initrd"
-	inst_d /etc /tmp /proc /newroot
+	inst_d /tmp /newroot
 	inst /sbin/initrd-lvm /bin/lvm.static
 
 	# always make /dev on tmpfs for LVM2
@@ -1766,7 +1762,6 @@ initrd_gen_lvm() {
 
 initrd_gen_procdata() {
 	debug "Adding rootfs finding based on root= option support."
-	inst_d /proc
 	add_linuxrc <<-'EOF'
 		root="$(busybox awk ' /root=\/dev\// { gsub(/.*root=\/dev\//,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ' /proc/cmdline)"
 		if [ -n "$root" ]; then
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/147754ca159d40ca5eb541074dc043d8cbd92090



More information about the pld-cvs-commit mailing list