diff mbox

[1/1] busybox, mdev: Added option for disabling mdev -s in sysv-init

Message ID 8dd38da41410280a7ed6ff98fadef773d1cd4db2.1375168363.git.kibo@prevas.dk
State Accepted
Delegated to: Esben Haabendal
Headers show

Commit Message

Kim B√łndergaard July 30, 2013, 7:16 a.m. UTC
---
 recipes/busybox/busybox-configure.inc |  2 ++
 recipes/busybox/busybox-install.inc   | 26 ++++++++++++++++++++++++++
 recipes/busybox/files/busybox-mdev    |  4 ++++
 3 files changed, 32 insertions(+)

Comments

Esben Haabendal Aug. 7, 2013, 8:44 a.m. UTC | #1
Kim B√łndergaard <kibo@prevas.dk> writes:

> ---
>  recipes/busybox/busybox-configure.inc |  2 ++
>  recipes/busybox/busybox-install.inc   | 26 ++++++++++++++++++++++++++
>  recipes/busybox/files/busybox-mdev    |  4 ++++
>  3 files changed, 32 insertions(+)
>
> diff --git a/recipes/busybox/busybox-configure.inc b/recipes/busybox/busybox-configure.inc
> index 6caaf3e..0cfb779 100644

Looks good, I merged to master.  I added USE flag documentation to the
commit message.

/Esben
diff mbox

Patch

diff --git a/recipes/busybox/busybox-configure.inc b/recipes/busybox/busybox-configure.inc
index 6caaf3e..0cfb779 100644
--- a/recipes/busybox/busybox-configure.inc
+++ b/recipes/busybox/busybox-configure.inc
@@ -118,6 +118,8 @@  DEFAULT_USE_busybox_mdev_sysvinit_start = "10"
 RECIPE_FLAGS += "busybox_mdev_splashutils_progress busybox_mdev_splashutils_msg"
 SPLASHUTILS_INITSCRIPTS:>USE_busybox_mdev += " busybox_mdev"
 DEFAULT_USE_busybox_mdev_splashutils_msg = "\"Starting Mdev\""
+RECIPE_FLAGS += "busybox_mdev_dash_s"
+DEFAULT_USE_busybox_mdev_dash_s = "1"
 
 RECIPE_FLAGS += "busybox_klogd \
         busybox_klogd_sysvinit_start busybox_klogd_conlevel"
diff --git a/recipes/busybox/busybox-install.inc b/recipes/busybox/busybox-install.inc
index bfb0c11..de264b5 100644
--- a/recipes/busybox/busybox-install.inc
+++ b/recipes/busybox/busybox-install.inc
@@ -135,3 +135,29 @@  do_install () {
 		sysvinit_install_script ${SRCDIR}/busybox-httpd
 	fi
 }
+
+do_install[postfuncs] += "${BUSYBOX_INSTALL_POSTFUNCS}"
+BUSYBOX_INSTALL_POSTFUNCS = ""
+BUSYBOX_INSTALL_POSTFUNCS:>USE_busybox_mdev = " do_install_fix_mdev"
+
+python do_install_fix_mdev () {
+	import os, fileinput
+	path = d.get("D")
+	os.chdir(path)
+	sysconfdir=d.get("sysconfdir")
+	parse_state = "do_nothing"
+	for line in fileinput.FileInput("." + sysconfdir + "/init.d/busybox-mdev", inplace=1):
+		if d.get("USE_busybox_mdev_dash_s"):
+			line=line.replace("#mdev_dash_s SECTION_START", "")
+			line=line.replace("#mdev_dash_s SECTION_END", "")
+		else:
+			if parse_state == "do_nothing":
+				if line.find("#mdev_dash_s SECTION_START") == 0:
+					parse_state = "delete_line"
+					line = ""
+			else:
+				if line.find("#mdev_dash_s SECTION_END") == 0:
+					parse_state = "do_nothing"
+				line = ""
+		print line,
+}
diff --git a/recipes/busybox/files/busybox-mdev b/recipes/busybox/files/busybox-mdev
index c068b94..64ebfb6 100755
--- a/recipes/busybox/files/busybox-mdev
+++ b/recipes/busybox/files/busybox-mdev
@@ -34,16 +34,20 @@  if mountpoint -q /dev/shm/; then
   umount -l /dev/shm/
 fi
 
+#mdev_dash_s SECTION_START
 # Create tmpfs for /dev
 echo "Creating tmpfs at /dev"
 mount -t tmpfs tmpfs /dev -o size=64k,mode=0755
+#mdev_dash_s SECTION_END
 
 # Register mdev as hotplug event helper
 echo "$MDEV" > /proc/sys/kernel/hotplug
 
+#mdev_dash_s SECTION_START
 # Populate /dev from /sys info
 echo "Populating /dev using mdev"
 $MDEV -s
+#mdev_dash_s SECTION_END
 
 # Touch .udev to inform scripts that /dev needs no further setup
 touch /dev/.udev