1#  SPDX-License-Identifier: LGPL-2.1-or-later
2#
3#  This file is part of systemd.
4#
5#  systemd is free software; you can redistribute it and/or modify it
6#  under the terms of the GNU Lesser General Public License as published by
7#  the Free Software Foundation; either version 2.1 of the License, or
8#  (at your option) any later version.
9
10[Unit]
11Description=Serial Getty on %I
12Documentation=man:agetty(8) man:systemd-getty-generator(8)
13Documentation=http://0pointer.de/blog/projects/serial-console.html
14BindsTo=dev-%i.device
15After=dev-%i.device systemd-user-sessions.service plymouth-quit-wait.service getty-pre.target
16{% if HAVE_SYSV_COMPAT %}
17After=rc-local.service
18{% endif %}
19
20# If additional gettys are spawned during boot then we should make
21# sure that this is synchronized before getty.target, even though
22# getty.target didn't actually pull it in.
23Before=getty.target
24IgnoreOnIsolate=yes
25
26# IgnoreOnIsolate causes issues with sulogin, if someone isolates
27# rescue.target or starts rescue.service from multi-user.target or
28# graphical.target.
29Conflicts=rescue.service
30Before=rescue.service
31
32[Service]
33# The '-o' option value tells agetty to replace 'login' arguments with an
34# option to preserve environment (-p), followed by '--' for safety, and then
35# the entered username.
36ExecStart=-/sbin/agetty -o '-p -- \\u' --keep-baud 115200,57600,38400,9600 - $TERM
37Type=idle
38Restart=always
39UtmpIdentifier=%I
40StandardInput=tty
41StandardOutput=tty
42TTYPath=/dev/%I
43TTYReset=yes
44TTYVHangup=yes
45{% if not ENABLE_LOGIND %}
46KillMode=process
47{% endif %}
48IgnoreSIGPIPE=no
49SendSIGHUP=yes
50
51[Install]
52WantedBy=getty.target
53