Merge "serial-console: Use udev rules to startup getty"

This commit is contained in:
Jenkins 2014-03-26 05:33:52 +00:00 committed by Gerrit Code Review
commit 73c3b2c404
3 changed files with 6 additions and 7 deletions

View file

@ -1,4 +1,4 @@
Start getty on ttyS0 and/or ttyS1
Start getty on active serial consoles.
With ILO and other remote admin environments, having a serial console can be
useful for debugging and troubleshooting.
@ -7,4 +7,4 @@ For upstart:
If ttyS1 exists, getty will run on that, otherwise on ttyS0.
For systemd:
Try to start getty on both ttyS0 and ttyS1.
We dynamically start a getty on any active serial port via udev rules.

View file

@ -1,12 +1,10 @@
#!/bin/bash
home=$(dirname $0)
set -uex
SCRIPTDIR=$(dirname $0)
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
install -m 0644 -o root -g root ${SCRIPTDIR}/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
install -D -g root -o root -m 0644 ${SCRIPTDIR}/serial-console-udev.rules /etc/udev/rules.d/99-serial-console.rules
fi

View file

@ -0,0 +1 @@
SUBSYSTEM=="tty", ACTION=="add", TAG+="systemd", ENV{SYSTEMD_WANTS}+="getty@$name.service", ATTRS{type}=="4"