meta-google: console: Allow host console redirection
Originally written by William, upstreaming it from our downstream repo.
Signed-off-by: William A. Kennington III <wak@google.com>
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: If23d97cb2505f45af089571d77a70a32a37d1ce8
diff --git a/meta-google/recipes-phosphor/console/obmc-console/serial-to-bmc@.service b/meta-google/recipes-phosphor/console/obmc-console/serial-to-bmc@.service
new file mode 100644
index 0000000..f8c55b3
--- /dev/null
+++ b/meta-google/recipes-phosphor/console/obmc-console/serial-to-bmc@.service
@@ -0,0 +1,22 @@
+[Unit]
+Description=BMC Serial Getty on %I
+BindsTo=dev-%i.device
+After=dev-%i.device systemd-user-sessions.service
+After=rc-local.service
+Before=getty.target
+IgnoreOnIsolate=yes
+
+Conflicts=serial-to-host@%i.service
+StartLimitIntervalSec=0
+
+[Service]
+Type=simple
+Restart=no
+RestartSec=0
+ExecStart=-/sbin/agetty -8 -n -o '-f root' -i -N -R -L %I 115200 xterm
+ExecStopPost=-/bin/sh -c 'systemctl start --no-block serial-to-host@%i'
+UtmpIdentifier=%I
+TTYPath=/dev/%I
+KillMode=process
+IgnoreSIGPIPE=no
+SendSIGHUP=yes