meta-digi/meta-digi-dey/recipes-digi/auto-serial-console/auto-serial-console/auto-getty-systemd

25 lines
512 B
Bash

#!/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