@@ -16,6 +16,10 @@ BUSYBOX_CFLAGS = \
BUSYBOX_LDFLAGS = \
$(TARGET_LDFLAGS)
+# initscripts contains/install only inittab and the init.d folder with base
+# scripts.
+BUSYBOX_DEPENDENCIES = initscripts
+
# Link against libtirpc if available so that we can leverage its RPC
# support for NFS mounting with BusyBox
ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
similarity index 100%
rename from system/skeleton/etc/inittab
rename to package/initscripts/busybox_inittab
similarity index 100%
rename from system/skeleton/etc/init.d/S20urandom
rename to package/initscripts/init.d/S20urandom
similarity index 100%
rename from system/skeleton/etc/init.d/S40network
rename to package/initscripts/init.d/S40network
similarity index 100%
rename from system/skeleton/etc/init.d/rcK
rename to package/initscripts/init.d/rcK
similarity index 100%
rename from system/skeleton/etc/init.d/rcS
rename to package/initscripts/init.d/rcS
new file mode 100644
@@ -0,0 +1,28 @@
+################################################################################
+#
+# initscripts
+#
+################################################################################
+
+# source included in buildroot
+INITSCRIPTS_SOURCE =
+
+# Note: We need to override Busybox's inittab with an inittab compatible with
+# sysvinit if we want SYSVINIT as our init.
+ifeq ($(BR2_PACKAGE_SYSVINIT),y)
+define INITSCRIPTS_INSTALL_INITTAB
+ $(INSTALL) -D -m 0644 package/initscripts/sysvinit_inittab $(TARGET_DIR)/etc/inittab
+endef
+else
+define INITSCRIPTS_INSTALL_INITTAB
+ $(INSTALL) -D -m 0644 package/initscripts/busybox_inittab $(TARGET_DIR)/etc/inittab
+endef
+endif
+
+define INITSCRIPTS_INSTALL_TARGET_CMDS
+ mkdir -p $(TARGET_DIR)/etc/init.d
+ $(INSTALL) -D -m 0755 package/initscripts/init.d/* $(TARGET_DIR)/etc/init.d/
+ $(INITSCRIPTS_INSTALL_INITTAB)
+endef
+
+$(eval $(generic-package))
similarity index 100%
rename from package/sysvinit/inittab
rename to package/initscripts/sysvinit_inittab
@@ -11,9 +11,13 @@ SYSVINIT_SITE = $(BR2_DEBIAN_MIRROR)/debian/pool/main/s/sysvinit
SYSVINIT_LICENSE = GPLv2+
SYSVINIT_LICENSE_FILES = COPYING
-# Override BusyBox implementations if BusyBox is enabled.
+# initscripts contains/install only inittab and the init.d folder with base
+# scripts.
+SYSVINIT_DEPENDENCIES = initscripts
+
+# Override Busybox implementations if Busybox is enabled.
ifeq ($(BR2_PACKAGE_BUSYBOX),y)
-SYSVINIT_DEPENDENCIES = busybox
+SYSVINIT_DEPENDENCIES += busybox
endif
define SYSVINIT_DEBIAN_PATCHES
@@ -34,9 +38,6 @@ define SYSVINIT_INSTALL_TARGET_CMDS
for x in halt init shutdown killall5; do \
$(INSTALL) -D -m 0755 $(@D)/src/$$x $(TARGET_DIR)/sbin/$$x || exit 1; \
done
- # Override BusyBox's inittab with an inittab compatible with
- # sysvinit
- $(INSTALL) -D -m 0644 package/sysvinit/inittab $(TARGET_DIR)/etc/inittab
ln -sf /sbin/halt $(TARGET_DIR)/sbin/reboot
ln -sf /sbin/halt $(TARGET_DIR)/sbin/poweroff
ln -sf killall5 $(TARGET_DIR)/sbin/pidof
The folder init.d is currently installed by default since it's part of our skeleton. This patch creates a package out of it and make busybox/sysvinit depends on it. This way, if you chose another init, you don't end up with a useless init.d folder. Signed-off-by: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> --- v3 -> v4: - Fix bug with busybox v2 -> v3: - Fix rebase issues v1 -> v2: - Redo the patch using git format-patch -M --- package/busybox/busybox.mk | 4 ++++ .../inittab => package/initscripts/busybox_inittab | 0 .../etc => package/initscripts}/init.d/S20urandom | 0 .../etc => package/initscripts}/init.d/S40network | 0 .../etc => package/initscripts}/init.d/rcK | 0 .../etc => package/initscripts}/init.d/rcS | 0 package/initscripts/initscripts.mk | 28 ++++++++++++++++++++++ .../inittab => initscripts/sysvinit_inittab} | 0 package/sysvinit/sysvinit.mk | 11 +++++---- 9 files changed, 38 insertions(+), 5 deletions(-) rename system/skeleton/etc/inittab => package/initscripts/busybox_inittab (100%) rename {system/skeleton/etc => package/initscripts}/init.d/S20urandom (100%) rename {system/skeleton/etc => package/initscripts}/init.d/S40network (100%) rename {system/skeleton/etc => package/initscripts}/init.d/rcK (100%) rename {system/skeleton/etc => package/initscripts}/init.d/rcS (100%) create mode 100644 package/initscripts/initscripts.mk rename package/{sysvinit/inittab => initscripts/sysvinit_inittab} (100%)