system: move remounting / to the corresponding init systems
authorYann E. MORIN <yann.morin.1998@free.fr>
Tue, 18 Jul 2017 17:25:33 +0000 (19:25 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Sat, 22 Jul 2017 20:34:40 +0000 (22:34 +0200)
Currently, remounting / read-write (or not) is done by the skeleton
package when the init system is either busybox or sysvinit, by
registering a target-finalize hook; it is not done at all for systemd.

Move registering this target-finalize hook to both of busybox and
sysvinit. Leave systemd alone, we'll take care of it later.

Rename the macro to a more meaningful name, and move it to system.mk
with the other such macros.

Yet a little bit less init-system knowledge in the skeleton.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[Thomas: remove not-so-useful comments, as pointed by Arnout.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/busybox/busybox.mk
package/skeleton/skeleton.mk
package/sysvinit/sysvinit.mk
system/system.mk

index 2001c2dbdb80df8e04c2a18a0e629b627b9e64c2..52b6f0f32854862d314b14a3c9f70f8e6ba79b08 100644 (file)
@@ -194,6 +194,8 @@ endef
 BUSYBOX_TARGET_FINALIZE_HOOKS += BUSYBOX_SET_GETTY
 endif # BR2_TARGET_GENERIC_GETTY
 
+BUSYBOX_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB
+
 endif # BR2_INIT_BUSYBOX
 
 ifeq ($(BR2_PACKAGE_BUSYBOX_SELINUX),y)
index 7ad2cb1a66697d768b9c97b868a0eff5ecdb8e19..4a66f6cecab2cacb56bad15bb65f2b9f1ef6d997 100644 (file)
@@ -148,21 +148,6 @@ endif
 endif
 TARGET_FINALIZE_HOOKS += SKELETON_BIN_SH
 
-ifeq ($(BR2_INIT_BUSYBOX)$(BR2_INIT_SYSV),y)
-ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
-# Find commented line, if any, and remove leading '#'s
-define SKELETON_REMOUNT_RW
-       $(SED) '/^#.*-o remount,rw \/$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab
-endef
-else
-# Find uncommented line, if any, and add a leading '#'
-define SKELETON_REMOUNT_RW
-       $(SED) '/^[^#].*-o remount,rw \/$$/s~^~#~' $(TARGET_DIR)/etc/inittab
-endef
-endif
-TARGET_FINALIZE_HOOKS += SKELETON_REMOUNT_RW
-endif # BR2_INIT_BUSYBOX || BR2_INIT_SYSV
-
 endif # BR2_ROOTFS_SKELETON_DEFAULT
 
 $(eval $(generic-package))
index e9aa69b27b0fcf4f805b34f237bf72bd85ecaa35..a606ddabf025e8b8aa643a0e4aa405e6759269fd 100644 (file)
@@ -55,4 +55,6 @@ endef
 SYSVINIT_TARGET_FINALIZE_HOOKS += SYSVINIT_SET_GETTY
 endif # BR2_TARGET_GENERIC_GETTY
 
+SYSVINIT_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB
+
 $(eval $(generic-package))
index 7b843dad8e236e05745d77616dc2358aebcdfa4d..ca6bf1388f393f0d37f826623e42f17bffaf3924 100644 (file)
@@ -28,6 +28,9 @@
 # - SYSTEM_GETTY_OPTIONS
 #   the un-quoted getty setting
 #
+# - SYSTEM_REMOUNT_ROOT_INITTAB
+#   set inittab to remount root read-write or read-only
+#
 
 # This function handles the merged or non-merged /usr cases
 ifeq ($(BR2_ROOTFS_MERGED_USR),y)
@@ -71,3 +74,15 @@ SYSTEM_GETTY_PORT = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_PORT))
 SYSTEM_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRATE))
 SYSTEM_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM))
 SYSTEM_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS))
+
+ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y)
+# Find commented line, if any, and remove leading '#'s
+define SYSTEM_REMOUNT_ROOT_INITTAB
+       $(SED) '/^#.*-o remount,rw \/$$/s~^#\+~~' $(TARGET_DIR)/etc/inittab
+endef
+else
+# Find uncommented line, if any, and add a leading '#'
+define SYSTEM_REMOUNT_ROOT_INITTAB
+       $(SED) '/^[^#].*-o remount,rw \/$$/s~^~#~' $(TARGET_DIR)/etc/inittab
+endef
+endif