systemrescue-zfs/airootfs/usr/share/sysrescue/template/serial-autoterminal.service
Gerd v. Egidy c2060e8a73 implement handling of serial consoles for autoterminal
serial consoles have separate systemd services (serial-getty@.service). We need to adapt
the handling and also need some different options for them than for regular gettys.

To allow sysrescue-initialize.py to differentiate between regular consoles and serial ones
they must be configured with the prefix "serial:" in the yaml, for example like this:

autoterminal:
    "serial:ttyS0": "/usr/bin/bash"
2022-05-12 22:53:57 +02:00

55 lines
1.6 KiB
Desktop File

# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of SystemRescue, based on serial-getty@.service from systemd
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=SystemRescue serial autoterminal %TTY%
Documentation=https://www.system-rescue.org/manual/autoterminal/
BindsTo=dev-%TTY%.device
After=dev-%TTY%.device systemd-user-sessions.service plymouth-quit-wait.service \
getty-pre.target serial-getty@%TTY%.service
# If additional gettys are spawned during boot then we should make
# sure that this is synchronized before getty.target, even though
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes
# IgnoreOnIsolate causes issues with sulogin, if someone isolates
# rescue.target or starts rescue.service from multi-user.target or
# graphical.target.
Conflicts=rescue.service serial-getty@%TTY%.service
Before=rescue.service
[Service]
ExecStart=-%EXEC%
# do not wait 5 seconds as for Type=idle before starting the service
Type=simple
Restart=always
RestartSec=1
UtmpIdentifier=%TTY%
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/%TTY%
TTYReset=yes
TTYVHangup=yes
IgnoreSIGPIPE=no
SendSIGHUP=yes
# make this a systemd-logind session without needing a getty
User=root
PAMName=login
# generate all utmp/wtmp entries and don't expect the program to do it
UtmpMode=user
[Install]
WantedBy=getty.target