retroarch-standalone-service/init/kodi-x11.service
graysky 34515c3338 Consistent behavior on a systemctl stop vs reboot
If I call systemctl to shutdown or reboot, the effect is that it does
not honor kodi-x11.service's ExecStop= line which results in an
unclean exit of kodi and of data loss since kodi writes out some data
when it exits.  By contrast, calling systemctl to stop the service
works as expected.

It seems systemd treats processes in user.slice differently that those
in system.slice and that removing PAMName=login was to blame for kodi's
processes running in user.slice.

Discussion:
https://lists.freedesktop.org/archives/systemd-devel/2020-December/045713.html
https://bbs.archlinux.org/viewtopic.php?id=261684
2020-12-16 13:32:25 -05:00

26 lines
940 B
Desktop File

[Unit]
Description=Kodi standalone (X11)
After=remote-fs.target network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
EnvironmentFile=-/etc/conf.d/kodi-standalone
TTYPath=/dev/tty1
Environment=WINDOWING=x11
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi-x11
Restart=on-abort
StandardInput=tty
StandardOutput=journal
# Without this we will wait the default 90s for this service to go down
# due to xinit staying alive. I don't know of a better way to do this
# without several service files one for the xserver and another for kodi.
# If this bothers you, run kodi-gbm instead which doesn't suffer from this.
TimeoutStopSec=10s
[Install]
Alias=display-manager.service