summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2019-08-04 14:14:17 +0200
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>2019-09-23 22:29:28 +0200
commit4019559de087d9b3a7f54d6b05e388af92b41746 (patch)
tree81b21969d88be1e14853b5edba6d0c33e7637a76 /package
parentaf8c7b41f515e76b4f00cd333e938d09fd1503d4 (diff)
package/openrc: add support for spawning getty
We install a template getty service, and we 'instantiate' it in the default runlevel, using the configured tty. Ideally, packages that provide a getty program would be responsible for installing the corresponding service file. However, to keep consistency with the existing init systems (busybox, systemd, and sysv), so we do provide it from the openrc package itself. OpenRC only acts on the files in a runlevel sub-directory, but the documentation [0] actually suggests that the instance symlink be done in init.d, and then again symlinked into the actual runlevel sub-directory. So, we abide by the rules. Also, to be noted, the getty service file is installed without ensuring that a getty command is available. This again is not unlike other init systems, sysvinit and busybox, which behave the same. [0] https://wiki.gentoo.org/wiki/OpenRC Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl> [yann.morin.1998@free.fr: - move getty template to openrc package (Thomas) - fix namespace of the vaiables (Thomas) - simplify creation of the defaults file - rewrite commit log ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Diffstat (limited to 'package')
-rwxr-xr-xpackage/openrc/getty24
-rw-r--r--package/openrc/openrc.mk18
-rw-r--r--package/skeleton-init-openrc/skeleton/etc/conf.d/.empty0
-rw-r--r--package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty0
4 files changed, 42 insertions, 0 deletions
diff --git a/package/openrc/getty b/package/openrc/getty
new file mode 100755
index 0000000000..8fcb071f8a
--- /dev/null
+++ b/package/openrc/getty
@@ -0,0 +1,24 @@
+#!/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 53f2947dcc..5978b6de5d 100644
--- a/package/openrc/openrc.mk
+++ b/package/openrc/openrc.mk
@@ -42,4 +42,22 @@ define OPENRC_REMOVE_UNNEEDED
endef
OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_REMOVE_UNNEEDED
+ifeq ($(BR2_TARGET_GENERIC_GETTY),y)
+OPENRC_GETTY_SVCNAME = getty.$(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)\""; \
+ } > $(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 /etc/init.d/$(OPENRC_GETTY_SVCNAME) \
+ $(TARGET_DIR)/etc/runlevels/default/$(OPENRC_GETTY_SVCNAME)
+endef
+OPENRC_TARGET_FINALIZE_HOOKS += OPENRC_SET_GETTY
+endif # BR2_TARGET_GENERIC_GETTY
+
$(eval $(generic-package))
diff --git a/package/skeleton-init-openrc/skeleton/etc/conf.d/.empty b/package/skeleton-init-openrc/skeleton/etc/conf.d/.empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/etc/conf.d/.empty
diff --git a/package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/package/skeleton-init-openrc/skeleton/etc/runlevels/default/.empty