auto-serial-console: add systemd support
Add systemd auto-getty.service to run agetty on the console defined in the kernel command line on platforms with systemd support. This service replaces serial-getty@.service as the one responsible for opening a tty port and prompting for a login name when TRUSTFENCE_CONSOLE_DISABLE is configured. https://jira.digi.com/browse/DEL-7242 Signed-off-by: Gonzalo Ruiz <Gonzalo.Ruiz@digi.com>
This commit is contained in:
parent
3b0cf4eb76
commit
f1c1bbdffb
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
[ -f "/etc/default/autogetty" ] && . /etc/default/autogetty
|
||||
|
||||
[ "${ENABLED}" != "1" ] && exit
|
||||
|
||||
for arg in $(cat /proc/cmdline); do
|
||||
case "${arg}" in
|
||||
console=*)
|
||||
eval ${arg}
|
||||
TTY="${console%,*}"
|
||||
SPEED="${console#*,}"
|
||||
|
||||
# If no speed is given default to 115200 and fall-back
|
||||
[ "${SPEED}" = "${TTY}" ] && SPEED="115200,57600,38400,19200,9600"
|
||||
|
||||
if [ -n "${TTY}" ] && grep -qs "${TTY}" /etc/securetty; then
|
||||
setsid /sbin/agetty -8 -L ${TTY} ${SPEED} xterm
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# This file is part of systemd.
|
||||
#
|
||||
# systemd is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation; either version 2.1 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
[Unit]
|
||||
Description=Serial Auto-Getty
|
||||
After=systemd-user-sessions.service plymouth-quit-wait.service
|
||||
After=rc-local.service
|
||||
|
||||
# If additional gettys are spawned during boot then we should make
|
||||
# sure that this is synchronized before getty.target, even though
|
||||
# getty.target didn't actually pull it in.
|
||||
Before=getty.target
|
||||
IgnoreOnIsolate=yes
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/auto-getty
|
||||
Type=idle
|
||||
Restart=always
|
||||
RestartSec=0
|
||||
|
||||
[Install]
|
||||
WantedBy=getty.target
|
||||
|
|
@ -7,18 +7,22 @@ LIC_FILES_CHKSUM = "\
|
|||
file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \
|
||||
"
|
||||
|
||||
AUTOGETTY_FILE="${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'auto-getty-systemd', 'auto-getty-sysvinit', d)}"
|
||||
|
||||
SRC_URI = "\
|
||||
file://autogetty \
|
||||
file://auto-getty \
|
||||
file://${AUTOGETTY_FILE} \
|
||||
file://auto-getty.service \
|
||||
file://auto-serial-console \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
inherit update-rc.d
|
||||
inherit systemd update-rc.d
|
||||
|
||||
INITSCRIPT_NAME = "auto-serial-console"
|
||||
INITSCRIPT_PARAMS = "start 99 5 ."
|
||||
SYSTEMD_SERVICE_${PN} = "auto-getty.service"
|
||||
|
||||
do_install () {
|
||||
install -m 0755 -d ${D}${sysconfdir}/default
|
||||
|
|
@ -29,6 +33,9 @@ do_install () {
|
|||
install -m 0755 -d ${D}${sysconfdir}/init.d
|
||||
install -m 0755 ${WORKDIR}/auto-serial-console ${D}${sysconfdir}/init.d/auto-serial-console
|
||||
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/auto-getty.service ${D}${systemd_unitdir}/system/auto-getty.service
|
||||
|
||||
install -m 0755 -d ${D}${bindir}
|
||||
install -m 0755 ${WORKDIR}/auto-getty ${D}${bindir}/auto-getty
|
||||
install -m 0755 ${WORKDIR}/${AUTOGETTY_FILE} ${D}${bindir}/auto-getty
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue