From: unixmania at gmail.com <unixmania@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service
Date: Sun, 1 Mar 2020 12:17:44 -0300 [thread overview]
Message-ID: <20200301151747.25723-2-unixmania@gmail.com> (raw)
In-Reply-To: <20200301151747.25723-1-unixmania@gmail.com>
From: Carlos Santos <unixmania@gmail.com>
In Buildroot getty is provided by BusyBox or util-linux (agetty). Both
create a /sbin/getty symlink pointing to the actual program, so make the
agetty service use that path instead of /sbin/agetty.
Also start agetty after all other services, to prevent mixing startup
messages with the getty prompt on devices with a single serial console.
This allows us to drop the custom getty service, which causes an error
message from openrc 0.42.1 (in a forthcoming patch):
Error: getty is the name of a real and virtual service.
The patches are required because it's not possible to override the
command or startup order by means of a configuration file. Anyway it's
still better to patch something maintained upstream than depending on a
custom piece that may easily become obsolete.
Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
CC: Adam Duskett <Aduskett@gmail.com>
---
...ty-replace-sbin-agetty-by-sbin-getty.patch | 33 +++++++++++++++++++
...getty-start-agetty-after-all-sevices.patch | 29 ++++++++++++++++
package/openrc/getty | 24 --------------
package/openrc/openrc.mk | 8 ++---
4 files changed, 65 insertions(+), 29 deletions(-)
create mode 100644 package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
create mode 100644 package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
delete mode 100755 package/openrc/getty
diff --git a/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch b/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
new file mode 100644
index 0000000000..feeff22254
--- /dev/null
+++ b/package/openrc/0003-init.d-agetty-replace-sbin-agetty-by-sbin-getty.patch
@@ -0,0 +1,33 @@
+From b39ab180358ed451eae9df900f49a72ef1eb7442 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <unixmania@gmail.com>
+Date: Sun, 1 Mar 2020 09:04:48 -0300
+Subject: [PATCH] init.d/agetty: replace /sbin/agetty by /sbin/getty
+
+In Buildroot getty is provided by BusyBox or util-linux (agetty). Both
+create a /sbin/getty symlink pointing to the actual program, so make the
+agetty service use that path instead of /sbin/agetty.
+
+The patch is required because it's not possible to override the command
+by means of a configuration file.
+
+Signed-off-by: Carlos Santos <unixmania@gmail.com>
+---
+ init.d/agetty.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/init.d/agetty.in b/init.d/agetty.in
+index e4866f7a..e1864628 100644
+--- a/init.d/agetty.in
++++ b/init.d/agetty.in
+@@ -14,7 +14,7 @@ supervisor=supervise-daemon
+ port="${RC_SVCNAME#*.}"
+ respawn_period="${respawn_period:-60}"
+ term_type="${term_type:-linux}"
+-command=/sbin/agetty
++command=/sbin/getty
+ command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"
+ pidfile="/run/${RC_SVCNAME}.pid"
+
+--
+2.18.2
+
diff --git a/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch b/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
new file mode 100644
index 0000000000..f1c927a450
--- /dev/null
+++ b/package/openrc/0004-init.d-agetty-start-agetty-after-all-sevices.patch
@@ -0,0 +1,29 @@
+From c2dc04f6b8c6784941b896e0b17c160dd43a566f Mon Sep 17 00:00:00 2001
+From: Carlos Santos <unixmania@gmail.com>
+Date: Sun, 1 Mar 2020 11:14:37 -0300
+Subject: [PATCH] init.d/agetty: start agetty after all services
+
+This is required for Buildroot, to prevent mixing service initialization
+messages with the getty prompt on devices with a single serial console.
+
+Signed-off-by: Carlos Santos <unixmania@gmail.com>
+---
+ init.d/agetty.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/init.d/agetty.in b/init.d/agetty.in
+index e1864628..a1ad4e9f 100644
+--- a/init.d/agetty.in
++++ b/init.d/agetty.in
+@@ -19,7 +19,7 @@ command_args_foreground="${agetty_options} ${port} ${baud} ${term_type}"
+ pidfile="/run/${RC_SVCNAME}.pid"
+
+ depend() {
+- after local
++ after *
+ keyword -prefix
+ provide getty
+ }
+--
+2.18.2
+
diff --git a/package/openrc/getty b/package/openrc/getty
deleted file mode 100755
index 8fcb071f8a..0000000000
--- a/package/openrc/getty
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/sbin/openrc-run
-# based on agetty service from OpenRC package
-
-description="start getty on terminal"
-supervisor=supervise-daemon
-port="${RC_SVCNAME#*.}"
-term_type="${term_type:-linux}"
-command=/sbin/getty
-command_args_foreground="${getty_options} ${baud} ${port} ${term_type}"
-pidfile="/run/${RC_SVCNAME}.pid"
-
-depend() {
- # start getty at the very end of init
- after *
- keyword -prefix
-}
-
-start_pre() {
- export EINFO_QUIET="${quiet:-yes}"
-}
-
-stop_pre() {
- export EINFO_QUIET="${quiet:-yes}"
-}
diff --git a/package/openrc/openrc.mk b/package/openrc/openrc.mk
index 1f8516f5ee..ce0b05e965 100644
--- a/package/openrc/openrc.mk
+++ b/package/openrc/openrc.mk
@@ -68,17 +68,15 @@ endef
OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
-OPENRC_GETTY_SVCNAME = getty.$(SYSTEM_GETTY_PORT)
+OPENRC_GETTY_SVCNAME = agetty.$(SYSTEM_GETTY_PORT)
OPENRC_GETTY_CONF_D = $(TARGET_DIR)/etc/conf.d/$(OPENRC_GETTY_SVCNAME)
define OPENRC_SET_GETTY
{ \
echo "baud=\"$(SYSTEM_GETTY_BAUDRATE)\""; \
echo "term_type=\"$(SYSTEM_GETTY_TERM)\"" ; \
- echo "getty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\""; \
+ echo "agetty_options=\"-L $(SYSTEM_GETTY_OPTIONS)\""; \
} > $(OPENRC_GETTY_CONF_D)
- $(INSTALL) -D -m 0755 $(OPENRC_PKGDIR)/getty \
- $(TARGET_DIR)/etc/init.d/getty
- ln -sf getty $(TARGET_DIR)/etc/init.d/$(OPENRC_GETTY_SVCNAME)
+ ln -sf agetty $(TARGET_DIR)/etc/init.d/$(OPENRC_GETTY_SVCNAME)
ln -sf /etc/init.d/$(OPENRC_GETTY_SVCNAME) \
$(TARGET_DIR)/etc/runlevels/default/$(OPENRC_GETTY_SVCNAME)
endef
--
2.18.2
next prev parent reply other threads:[~2020-03-01 15:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-01 15:17 [Buildroot] [PATCH/next v2 0/4] openrc: bump to version 0.42.1 unixmania at gmail.com
2020-03-01 15:17 ` unixmania at gmail.com [this message]
2020-03-11 16:52 ` [Buildroot] [PATCH/next v2 1/4] package/openrc: drop custom getty service Yann E. MORIN
2020-03-11 17:04 ` Carlos Santos
2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 2/4] package/openrc: bump to version 0.42.1 unixmania at gmail.com
2020-03-11 17:22 ` Yann E. MORIN
2020-03-12 2:03 ` Carlos Santos
2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 3/4] package/openrc: add libselinux support unixmania at gmail.com
2020-03-11 17:26 ` Yann E. MORIN
2020-03-11 17:35 ` Yann E. MORIN
2020-04-16 2:41 ` Carlos Santos
2020-04-16 2:20 ` Carlos Santos
2020-03-01 15:17 ` [Buildroot] [PATCH/next v2 4/4] support/testing: add openrc tests unixmania at gmail.com
2020-03-01 17:39 ` Yann E. MORIN
2020-03-03 11:59 ` Carlos Santos
2020-03-11 17:50 ` Yann E. MORIN
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200301151747.25723-2-unixmania@gmail.com \
--to=unixmania@gmail.com \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox