--- /dev/null
+#!/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}"
+}
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))
config BR2_TARGET_GENERIC_GETTY_TERM
string "TERM environment variable"
default "vt100"
- # currently observed only by busybox and sysvinit
- depends on BR2_INIT_BUSYBOX || BR2_INIT_SYSV
+ # currently observed by all but systemd
+ depends on !BR2_INIT_SYSTEMD
help
Specify a TERM type.
config BR2_TARGET_GENERIC_GETTY_OPTIONS
string "other options to pass to getty"
default ""
- # currently observed only by busybox and sysvinit
- depends on BR2_INIT_BUSYBOX || BR2_INIT_SYSV
+ # currently observed by all but systemd
+ depends on !BR2_INIT_SYSTEMD
help
Any other flags you want to pass to getty,
Refer to getty --help for details.