From ae22d394722f13439a70705849cea6c681fa6682 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 13 Jan 2014 13:02:54 -0500 Subject: [PATCH] Implement serial-console for systemd. Update install.d/20-stty so that we try to start a getty on ttyS0 and ttyS1 when using systemd. Change-Id: Id5b605c74bf82855af0af4d0f95659cdd3a7b3a0 --- elements/serial-console/README.md | 11 ++++++++--- elements/serial-console/install.d/20-stty | 9 +++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/elements/serial-console/README.md b/elements/serial-console/README.md index 202a5788..73ce59c9 100644 --- a/elements/serial-console/README.md +++ b/elements/serial-console/README.md @@ -1,5 +1,10 @@ -Start getty on ttyS0 or ttyS1 +Start getty on ttyS0 and/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. +useful for debugging and troubleshooting. + +For upstart: + If ttyS1 exists, getty will run on that, otherwise on ttyS0. + +For systemd: + Try to start getty on both ttyS0 and ttyS1. diff --git a/elements/serial-console/install.d/20-stty b/elements/serial-console/install.d/20-stty index ca91e7df..fe1e0b12 100755 --- a/elements/serial-console/install.d/20-stty +++ b/elements/serial-console/install.d/20-stty @@ -3,5 +3,10 @@ home=$(dirname $0) set -uex -install -m 0644 -o root -g root $home/ttySx.conf /etc/init/ttySx.conf - +DIB_INIT_SYSTEM=$(dib-init-system) +if [ "$DIB_INIT_SYSTEM" == "upstart" ]; then + install -m 0644 -o root -g root $home/ttySx.conf /etc/init/ttySx.conf +elif [ "$DIB_INIT_SYSTEM" == "systemd" ]; then + ln -s /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttyS0.service + ln -s /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@ttyS1.service +fi