commit: 3c23b30aed805fb5f6b148f273c0c139eac8f6f3
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 19 17:18:18 2019 +0000
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Sep 19 17:19:37 2019 +0000
URL: https://gitweb.gentoo.org/proj/livecd-tools.git/commit/?id=3c23b30a
fixinittab: Refactor HW-specific serial console support
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
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