package/sysvinit: comment out login line in inittab if getty is disabled
authorCarlos Santos <unixmania@gmail.com>
Sun, 27 Oct 2019 13:00:07 +0000 (10:00 -0300)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sun, 27 Oct 2019 13:09:35 +0000 (14:09 +0100)
When the "Run a getty" option is disabled, sysvinit doesn't remove the
/etc/inittab line from previous builds. With this patch, the line is
correctly commented out.

Based on similar change made by Stephen Bos <stephen.bos@hagergroup.com>
and Christophe Blaess <christophe.blaess@logilin.fr> for busybox.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
package/sysvinit/sysvinit.mk

index 98a37fc7602244dc68151b5fcb198ff733685e45..c778a9cde5bd6a0280c0caeddfa452a86f5c12fc 100644 (file)
@@ -36,8 +36,13 @@ define SYSVINIT_SET_GETTY
        $(SED) '/# GENERIC_SERIAL$$/s~^.*#~$(shell echo $(SYSTEM_GETTY_PORT) | tail -c+4)::respawn:/sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) #~' \
                $(TARGET_DIR)/etc/inittab
 endef
-SYSVINIT_TARGET_FINALIZE_HOOKS += SYSVINIT_SET_GETTY
+else
+define SYSVINIT_SET_GETTY
+       $(SED) '/# GENERIC_SERIAL$$/s~^.*#~# S0:1:respawn:/sbin/getty -L ttyS0 115200 vt100 #~' \
+               $(TARGET_DIR)/etc/inittab
+endef
 endif # BR2_TARGET_GENERIC_GETTY
+SYSVINIT_TARGET_FINALIZE_HOOKS += SYSVINIT_SET_GETTY
 
 SYSVINIT_TARGET_FINALIZE_HOOKS += SYSTEM_REMOUNT_ROOT_INITTAB