From 3c23b30aed805fb5f6b148f273c0c139eac8f6f3 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Thu, 19 Sep 2019 10:18:18 -0700 Subject: fixinittab: Refactor HW-specific serial console support Signed-off-by: Matt Turner --- init.d/fixinittab | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/init.d/fixinittab b/init.d/fixinittab index 4491217..b0fcaeb 100644 --- a/init.d/fixinittab +++ b/init.d/fixinittab @@ -30,6 +30,25 @@ start() sed -i -e '/^s[01]/ s/^/#/' /etc/inittab sed -i -e '/^b0/ s/^/#/' /etc/inittab + if [ -z "${LIVECD_CONSOLE}" ] + then + for c in hvc0 + do + if [ -c "/dev/${c}" ] + then + LIVECD_CONSOLE_BAUD=$(stty -F "/dev/${c}" speed) + + eindent + ebegin "Adding ${c} console to inittab ..." + echo "s0:12345:respawn:/sbin/agetty -a root ${LIVECD_CONSOLE_BAUD} ${c}" >> /etc/inittab + eend $? + eoutdent + + break + fi + done + fi + # SPARC & HPPA console magic if [ "${HOSTTYPE}" = "sparc" -o "${HOSTTYPE}" = "hppa" ] then @@ -94,15 +113,6 @@ start() fi fi - if [ -c "/dev/hvc0" -a "${LIVECD_CONSOLE}" = "" ] - then - eindent - ebegin "Adding hvc console to inittab ..." - echo "s0:12345:respawn:/sbin/agetty -a root 9600 hvc0 vt320" >> /etc/inittab - eend $? - eoutdent - fi - # EFI-based machines should automatically hook up their console lines if dmesg | grep -q '^Adding console on' then -- cgit v1.2.3-65-gdbad