better ExecStop to cleanly exit fixes #23 and #24

Direct call to kodi-xxx in ExecStart= allows direction of kill signal to that
rather than to kodi-standalone wrapper.  This allows the kill signal to hit
the indented executable.  As well, using killall in the ExecStop= allows for
synchronous stopping and for kodi to do shutdown housekeeping tasks such as
saving settings, stopping services (web, zeroconf, etc.) and unloading things.
This commit is contained in:
graysky 2020-10-10 09:13:36 -04:00
parent 3fcd54aad5
commit 847b6ec656
6 changed files with 15 additions and 17 deletions

View File

@ -1,7 +1,7 @@
# kodi-standalone-service # kodi-standalone-service
Systemd service units to run [Kodi](https://kodi.tv/) in standalone mode without the need for a DE. X11, Wayland, and GBM are supported. Systemd service units to run [Kodi](https://kodi.tv/) in standalone mode without the need for a DE. X11, Wayland, and GBM are supported.
Which one to choose? Depends... Which one to choose?
In terms of functionality, X11 is probably the most mature and feature rich. Wayland is next in line and should be considered on-par with X11, however, a known limitation of Wayland is having the resolution and frame rate set in the compositor rather than in kodi's GUI. As well, Wayland currently does not support VT switching. GBM has some known features it lacks compared the X11 and Wayland. A complete list can be found in [Kodi issue 14876](https://github.com/xbmc/xbmc/issues/14876). In terms of functionality, X11 is probably the most mature and feature rich. Wayland is next in line and should be considered on-par with X11, however, a known limitation of Wayland is having the resolution and frame rate set in the compositor rather than in kodi's GUI. As well, Wayland currently does not support VT switching. GBM has some known features it lacks compared the X11 and Wayland. A complete list can be found in [Kodi issue 14876](https://github.com/xbmc/xbmc/issues/14876).
@ -17,7 +17,7 @@ Users of ARM distros such as Arch ARM, Raspberry Pi OS (formerly Raspbian), etc.
### Ubuntu ### Ubuntu
For the kodi user to access devices on `/dev/ttyxxxx`, users will need to edit `init/sysusers.conf` and uncomment the line corresponding to enable membership in the dialout group. For the kodi user to access devices on `/dev/ttyxxxx`, users will need to edit `init/sysusers.conf` and uncomment the line corresponding to enable membership in the dialout group.
### Other distros ### Other distros (manual installation)
Users of other distros should install the following files: Users of other distros should install the following files:
* `init/*.service` to `/usr/lib/systemd/system/` * `init/*.service` to `/usr/lib/systemd/system/`
@ -31,10 +31,10 @@ Simply [start/enable](https://wiki.archlinux.org/index.php/Systemd#Using_units)
## Dependencies ## Dependencies
* kodi (x11 or wayland or gbm) * kodi (x11 or wayland or gbm)
* polkit
* xorg-server and xorg-xinit (for running x11)
* libinput and cage (for running wayland) * libinput and cage (for running wayland)
* libinput (for running gbm) * libinput (for running gbm)
* polkit
* xorg-server and xorg-xinit (for running x11)
## Passing environment variables to the service ## Passing environment variables to the service
Should the need arise, one can pass environment variables to the service by creating `/etc/conf.d/kodi-standalone` and populating it with the needed variables. Should the need arise, one can pass environment variables to the service by creating `/etc/conf.d/kodi-standalone` and populating it with the needed variables.
@ -46,7 +46,7 @@ Much of the credit for this service goes to the Arch Linux maintainers of the of
### Service not starting ### Service not starting
Most users should not need `/etc/X11/Xwrapper.config` since the created X server becomes the [controlling process](http://www.freedesktop.org/software/systemd/man/systemd.exec.html#StandardInput=) of the VT to which it is bound. Most users does not mean all users. There have been reports of some AMD users still requiring this file. As well, users of Xorg's native modesetting driver may also require it. Most users should not need `/etc/X11/Xwrapper.config` since the created X server becomes the [controlling process](http://www.freedesktop.org/software/systemd/man/systemd.exec.html#StandardInput=) of the VT to which it is bound. Most users does not mean all users. There have been reports of some AMD users still requiring this file. As well, users of Xorg's native modesetting driver may also require it.
The recommendation is to first try starting `kodi.service` without it, but if the service fails to start X, you may need to create `/etc/X11/Xwrapper.config` which should contain the following: The recommendation is to first try starting `kodi-x11.service` without it, but if the service fails to start X, you may need to create `/etc/X11/Xwrapper.config` which should contain the following:
``` ```
needs_root_rights = yes needs_root_rights = yes
``` ```

View File

@ -12,11 +12,10 @@ SupplementaryGroups=input
PAMName=login PAMName=login
TTYPath=/dev/tty1 TTYPath=/dev/tty1
Environment=WINDOWING=gbm Environment=WINDOWING=gbm
ExecStart=/usr/bin/kodi-standalone ExecStart=/usr/lib/kodi/kodi-gbm --standalone
Restart=on-abort Restart=on-abort
StandardInput=tty StandardInput=tty
StandardOutput=file:/var/log/kodi-gbm-standalone.log StandardOutput=journal
StandardError=file:/var/log/kodi-gbm-standalone.log
[Install] [Install]
Alias=display-manager.service Alias=display-manager.service

View File

@ -11,11 +11,11 @@ EnvironmentFile=-/etc/conf.d/kodi-standalone
PAMName=login PAMName=login
TTYPath=/dev/tty1 TTYPath=/dev/tty1
Environment=WINDOWING=wayland Environment=WINDOWING=wayland
ExecStart=/usr/bin/cage -- /usr/bin/kodi-standalone ExecStart=/usr/bin/cage -- /usr/lib/kodi/kodi-wayland --standalone
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi-wayland
Restart=on-abort Restart=on-abort
StandardInput=tty StandardInput=tty
StandardOutput=file:/var/log/kodi-wayland-standalone.log StandardOutput=journal
StandardError=file:/var/log/kodi-wayland-standalone.log
[Install] [Install]
Alias=display-manager.service Alias=display-manager.service

View File

@ -11,12 +11,11 @@ EnvironmentFile=-/etc/conf.d/kodi-standalone
PAMName=login PAMName=login
TTYPath=/dev/tty1 TTYPath=/dev/tty1
Environment=WINDOWING=x11 Environment=WINDOWING=x11
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -nolisten tcp vt1 ExecStart=/usr/bin/xinit /usr/lib/kodi/kodi-x11 --standalone -- :0 -quiet -nolisten tcp vt1
ExecStop=/usr/bin/pkill kodi ExecStop=/usr/bin/killall --user kodi --exact --wait kodi-x11
Restart=on-abort Restart=on-abort
StandardInput=tty StandardInput=tty
StandardOutput=file:/var/log/kodi-x11-standalone.log StandardOutput=journal
StandardError=file:/var/log/kodi-x11-standalone.log
[Install] [Install]
Alias=display-manager.service Alias=display-manager.service