From a8707cc1524b22cd9416134b592a4d1e1d3e7747 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Thu, 9 May 2013 18:39:37 +1200 Subject: [PATCH] Add an element to configure a serial console. With ILO and other remote machine management cards, a serial console is actually useful. Change-Id: I86f74d9dae3821b4682df813c5b52a83a29a138a --- elements/serial-console/README.md | 5 +++++ elements/serial-console/install.d/20-stty | 7 +++++++ elements/serial-console/install.d/ttySx.conf | 15 +++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 elements/serial-console/README.md create mode 100755 elements/serial-console/install.d/20-stty create mode 100644 elements/serial-console/install.d/ttySx.conf diff --git a/elements/serial-console/README.md b/elements/serial-console/README.md new file mode 100644 index 00000000..202a5788 --- /dev/null +++ b/elements/serial-console/README.md @@ -0,0 +1,5 @@ +Start getty on ttyS0 or ttyS1 + +With ILO and other remote admin environments, having a serial console can be +useful for debugging / troubleshooting. If ttyS1 exists, getty will run on +that, otherwise on ttyS0. diff --git a/elements/serial-console/install.d/20-stty b/elements/serial-console/install.d/20-stty new file mode 100755 index 00000000..f8fa8e5f --- /dev/null +++ b/elements/serial-console/install.d/20-stty @@ -0,0 +1,7 @@ +#!/bin/sh + +home=$(dirname $0) +set -uex + +install -m 0644 -o root -g root $home/ttySx.conf /etc/init/ttySx.conf + diff --git a/elements/serial-console/install.d/ttySx.conf b/elements/serial-console/install.d/ttySx.conf new file mode 100644 index 00000000..2e11205b --- /dev/null +++ b/elements/serial-console/install.d/ttySx.conf @@ -0,0 +1,15 @@ +# This service maintains a getty on ttyS0/1 from the point the system is +# started until it is shut down again. + +start on stopped rc or RUNLEVEL=[2345] +stop on runlevel [!2345] + +respawn + +script + console_port=0 + echo "ttySx probing ttyS1" >/dev/ttyS1 2>/dev/null && console_port=1 + echo "ttySx: console tty = /dev/ttyS$console_port" >&2 + exec /sbin/agetty -m ttyS$console_port 115200,57600,38400,9600,4800 vt102 + +end script