## **************************************************************************
## For copyright and licensing terms, see the file named COPYING.
## **************************************************************************

[Unit]
Description=Terminal emulator driving %I
Before=ttylogin@%i-tty.service

[Service]
EnvironmentDirectory=env
Umask=0002
User=user-vt-emulator
SessionLeader=yes
# The user-vt-emulator user is not a member of this group.
# Running the emulator as this group grants the group's members realizer access to its I/O files.
Group=user-vt-realizer
PermissionsStartOnly=yes
# This mechanism now permits subdirectories.
RuntimeDirectory=dev/%I
RuntimeDirectoryMode=02755
# Files in /run/dev/%I have group user-vt-emulator by default, not group user-vt-realizer.
RuntimeDirectoryGroup=user-vt-emulator
# Not until we find out how to have ACLs in /run on FreeBSD.
#ExecStartPre=install -d -m 02775 -o root -g user-vt-emulator %t/dev/%I
#ExecStartPre=setfacl -m u:user-vt-emulator:rwx %t/dev/%I
ExecStart=pty-allocate console-terminal-emulator ${flags} %t/dev/%I
RestartSec=0

[Install]
WantedBy=ttylogin@%i-tty.service
WantedBy=multi-user.target
