forked for retroarch
This commit is contained in:
parent
182e3607e7
commit
3992804fe2
42
Makefile
42
Makefile
@ -1,4 +1,4 @@
|
||||
PN = kodi-standalone-service
|
||||
PN = retroarch-standalone-service
|
||||
|
||||
PREFIX ?= /usr
|
||||
INITDIR = $(PREFIX)/lib/systemd/system
|
||||
@ -29,11 +29,11 @@ common/$(PN):
|
||||
install-common:
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(UDEVDIR)"
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(ENVDIR)"
|
||||
$(INSTALL_DATA) $(ARCH)/udev/99-kodi.rules "$(DESTDIR)$(UDEVDIR)/99-kodi.rules"
|
||||
$(INSTALL_DATA) common/kodi-standalone "$(DESTDIR)$(ENVDIR)/kodi-standalone"
|
||||
$(INSTALL_DATA) $(ARCH)/udev/99-retroarch.rules "$(DESTDIR)$(UDEVDIR)/99-retroarch.rules"
|
||||
$(INSTALL_DATA) common/retroarch-standalone "$(DESTDIR)$(ENVDIR)/retroarch-standalone"
|
||||
ifeq ($(ARCH),arm)
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(POLKDIR)"
|
||||
$(INSTALL_DATA) $(ARCH)/polkit/polkit.rules "$(DESTDIR)$(POLKDIR)/99-kodi.rules"
|
||||
$(INSTALL_DATA) $(ARCH)/polkit/polkit.rules "$(DESTDIR)$(POLKDIR)/99-retroarch.rules"
|
||||
endif
|
||||
|
||||
install-init:
|
||||
@ -41,33 +41,33 @@ install-init:
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(USERDIR)"
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(TMPFDIR)"
|
||||
ifeq ($(ARCH),x86)
|
||||
$(INSTALL_DATA) $(ARCH)/init/kodi-gbm.service "$(DESTDIR)$(INITDIR)/kodi-gbm.service"
|
||||
$(INSTALL_DATA) $(ARCH)/init/kodi-wayland.service "$(DESTDIR)$(INITDIR)/kodi-wayland.service"
|
||||
$(INSTALL_DATA) $(ARCH)/init/kodi-x11.service "$(DESTDIR)$(INITDIR)/kodi-x11.service"
|
||||
$(INSTALL_DATA) $(ARCH)/init/retroarch-gbm.service "$(DESTDIR)$(INITDIR)/retroarch-gbm.service"
|
||||
$(INSTALL_DATA) $(ARCH)/init/retroarch-wayland.service "$(DESTDIR)$(INITDIR)/retroarch-wayland.service"
|
||||
$(INSTALL_DATA) $(ARCH)/init/retroarch-x11.service "$(DESTDIR)$(INITDIR)/retroarch-x11.service"
|
||||
else
|
||||
$(INSTALL_DATA) $(ARCH)/init/kodi.service "$(DESTDIR)$(INITDIR)/kodi.service"
|
||||
$(INSTALL_DATA) $(ARCH)/init/retroarch.service "$(DESTDIR)$(INITDIR)/retroarch.service"
|
||||
endif
|
||||
$(INSTALL_DATA) $(ARCH)/init/tmpfiles.conf "$(DESTDIR)$(TMPFDIR)/kodi-standalone.conf"
|
||||
$(INSTALL_DATA) $(ARCH)/init/sysusers.conf "$(DESTDIR)$(USERDIR)/kodi-standalone.conf"
|
||||
$(INSTALL_DATA) $(ARCH)/init/tmpfiles.conf "$(DESTDIR)$(TMPFDIR)/retroarch-standalone.conf"
|
||||
$(INSTALL_DATA) $(ARCH)/init/sysusers.conf "$(DESTDIR)$(USERDIR)/retroarch-standalone.conf"
|
||||
|
||||
install-man:
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(MANDIR)"
|
||||
$(INSTALL_DATA) $(ARCH)/doc/kodi.service.1 "$(DESTDIR)$(MANDIR)/kodi.service.1"
|
||||
$(INSTALL_DATA) $(ARCH)/doc/retroarch.service.1 "$(DESTDIR)$(MANDIR)/retroarch.service.1"
|
||||
|
||||
uninstall:
|
||||
ifeq ($(ARCH),x86)
|
||||
$(RM) "$(DESTDIR)$(INITDIR)/kodi-gbm.service"
|
||||
$(RM) "$(DESTDIR)$(INITDIR)/kodi-wayland.service"
|
||||
$(RM) "$(DESTDIR)$(INITDIR)/kodi-x11.service"
|
||||
$(RM) "$(DESTDIR)$(INITDIR)/retroarch-gbm.service"
|
||||
$(RM) "$(DESTDIR)$(INITDIR)/retroarch-wayland.service"
|
||||
$(RM) "$(DESTDIR)$(INITDIR)/retroarch-x11.service"
|
||||
else
|
||||
$(RM) "$(DESTDIR)$(INITDIR)/kodi.service"
|
||||
$(RM) "$(DESTDIR)$(POLKDIR)/99-kodi.rules"
|
||||
$(RM) "$(DESTDIR)$(INITDIR)/retroarch.service"
|
||||
$(RM) "$(DESTDIR)$(POLKDIR)/99-retroarch.rules"
|
||||
endif
|
||||
$(RM) "$(DESTDIR)$(TMPFDIR)/kodi-standalone.conf"
|
||||
$(RM) "$(DESTDIR)$(USERDIR)/kodi-standalone.conf"
|
||||
$(RM) "$(DESTDIR)$(UDEVDIR)/99-kodi.rules"
|
||||
$(RM) "$(DESTDIR)$(MANDIR)/kodi.service.1"
|
||||
$(RM) "$(DESTDIR)$(ENVDIR)/kodi-standalone"
|
||||
$(RM) "$(DESTDIR)$(TMPFDIR)/retroarch-standalone.conf"
|
||||
$(RM) "$(DESTDIR)$(USERDIR)/retroarch-standalone.conf"
|
||||
$(RM) "$(DESTDIR)$(UDEVDIR)/99-retroarch.rules"
|
||||
$(RM) "$(DESTDIR)$(MANDIR)/retroarch.service.1"
|
||||
$(RM) "$(DESTDIR)$(ENVDIR)/retroarch-standalone"
|
||||
|
||||
install: install-common install-init install-man
|
||||
|
||||
|
47
README.md
47
README.md
@ -1,9 +1,12 @@
|
||||
# kodi-standalone-service
|
||||
Run [Kodi](https://kodi.tv/) as an unprivileged user in standalone mode without the need for a full Desktop Environment. X11, Wayland, and GBM are supported.
|
||||
# retroarch-standalone-service
|
||||
|
||||
(fork of [Kodi Standalone Service](https://github.com/graysky2/kodi-standalone-service) by GraySky2)
|
||||
|
||||
Run [RetroArch](https://retroarch.com/) as an unprivileged user in standalone mode without the need for a full Desktop Environment. X11, Wayland, and GBM are supported.
|
||||
|
||||
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 retroarch'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 [RetroArch issue 14876](https://github.com/xbmc/xbmc/issues/14876).
|
||||
|
||||
Another factor that may affect choice is the number of dependencies required to run which will vary distro-to-distro.
|
||||
|
||||
@ -17,61 +20,43 @@ Users of other distros can just run `make install` as the root user. Then, as t
|
||||
* `systemd-sysusers`
|
||||
* `systemd-tmpfiles --create`
|
||||
|
||||
Note that the kodi user's home directory is `/var/lib/kodi/` in this example, NOT `/home/kodi/` like a regular user.
|
||||
Note that the retroarch user's home directory is `/var/lib/retroarch/` in this example, NOT `/home/retroarch/` like a regular user.
|
||||
|
||||
### Dependencies
|
||||
Note that I list some dependencies below that the Arch package already has listed as dependencies. This is to help users of other distros whose kodi packages may not have these listed. If you're installing this from the AUR package listed above, just pay attention to pacman's post-install message which calls out the Arch-specific `optdepends` needed for the various service files to work.
|
||||
Note that I list some dependencies below that the Arch package already has listed as dependencies. This is to help users of other distros whose retroarch packages may not have these listed. If you're installing this from the AUR package listed above, just pay attention to pacman's post-install message which calls out the Arch-specific `optdepends` needed for the various service files to work.
|
||||
|
||||
* kodi (>=19.1 on Arch Linux, lower versions may work with other distros)
|
||||
* retroarch (>=19.1 on Arch Linux, lower versions may work with other distros)
|
||||
* cage, libinput, and xorg-xwayland (for running wayland)
|
||||
* libinput (for running gbm)
|
||||
* xorg-server and xorg-xinit (for running x11)
|
||||
|
||||
#### Notes for users of non-Arch Linux distros
|
||||
1. Users of Ubuntu ≥20.0 will need to edit `/etc/sysusers.d/kodi-standalone.conf` and uncomment the line adding kodi user to the `render` group.
|
||||
1. Users of Ubuntu ≥20.0 will need to edit `/etc/sysusers.d/retroarch-standalone.conf` and uncomment the line adding retroarch user to the `render` group.
|
||||
|
||||
2. Users of Ubuntu wishing the kodi user to access devices on `/dev/ttyxxxx`, will need to edit `/etc/sysusers.d/kodi-standalone.conf` and uncomment the line adding the kodi user to the `dialout` group.
|
||||
2. Users of Ubuntu wishing the retroarch user to access devices on `/dev/ttyxxxx`, will need to edit `/etc/sysusers.d/retroarch-standalone.conf` and uncomment the line adding the retroarch user to the `dialout` group.
|
||||
|
||||
#### Notes for Users of RPiOS
|
||||
To use this with RPiOS requires a few extra steps.
|
||||
1. Set the boot preference to boot to the console, see https://github.com/graysky2/kodi-standalone-service/issues/37
|
||||
2. Replace `/usr/bin/kodi` with vanilla upstream's version. See [here](https://github.com/graysky2/kodi-standalone-service/files/7888328/kodi.txt) for an example that is known to work with RPiOS as of Matrix-19.3.
|
||||
2. Replace `/usr/bin/retroarch` with vanilla upstream's version. See [here](https://github.com/graysky2/kodi-standalone-service/files/7888328/retroarch.txt) for an example that is known to work with RPiOS as of Matrix-19.3.
|
||||
|
||||
## Usage
|
||||
Simply [start/enable](https://wiki.archlinux.org/index.php/Systemd#Using_units) the requisite service.
|
||||
|
||||
## Passing environment variables to the service
|
||||
Certain use cases require environment variables to be passed to the service. Define these variables in `/etc/conf.d/kodi-standalone` and they will be passed along to the service.
|
||||
Certain use cases require environment variables to be passed to the service. Define these variables in `/etc/conf.d/retroarch-standalone` and they will be passed along to the service.
|
||||
|
||||
## Notes on system shutdown/reboot
|
||||
Be aware that these services run Kodi in systemd's user.slice not in the system.slice. In order to have Kodi gracefully exit, the system should be called to shutdown or to reboot using the respective Kodi actions not by a call to systemctl. Failure to do so will result in an ungraceful exit of Kodi and the saving of GUI settings, Kodi uptime etc. will not occur. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run Kodi in systemd's system.slice instead, doing so makes it difficult to use USB mounts within Kodi and to use pulseaudio for Kodi sessions.
|
||||
|
||||
### Recommended methods to reboot/shutdown
|
||||
Here are several options:
|
||||
|
||||
* Select the corresponding option under Power menu in the Kodi GUI.
|
||||
* Use the official Android/iOS remote app.
|
||||
* If a CLI option is preferred, use `kodi-send` to issue a `Reboot` or `ShutDown()` like so:
|
||||
```
|
||||
$ kodi-send -a "Reboot"
|
||||
$ kodi-send -a "ShutDown()"
|
||||
```
|
||||
Be aware that these services run RetroArch in systemd's user.slice not in the system.slice. In order to have RetroArch gracefully exit, the system should be called to shutdown or to reboot using the respective RetroArch actions not by a call to systemctl. Failure to do so will result in an ungraceful exit of RetroArch and the saving of GUI settings, RetroArch uptime etc. will not occur. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run RetroArch in systemd's system.slice instead, doing so makes it difficult to use USB mounts within RetroArch and to use pulseaudio for RetroArch sessions.
|
||||
|
||||
## Acknowledgments
|
||||
Much of the credit for this service goes to the Arch Linux maintainers of the official kodi package. Note that they removed it upon the [1.16-1 release of Xorg](https://git.archlinux.org/svntogit/community.git/commit/trunk?h=packages/xbmc&id=9763c6d32678f3a3f45c195bfae92eee209d504f).
|
||||
Much of the credit for this service goes to the Arch Linux maintainers of the official retroarch package. Note that they removed it upon the [1.16-1 release of Xorg](https://git.archlinux.org/svntogit/community.git/commit/trunk?h=packages/xbmc&id=9763c6d32678f3a3f45c195bfae92eee209d504f).
|
||||
|
||||
## Tips and Tricks
|
||||
### 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.
|
||||
|
||||
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:
|
||||
The recommendation is to first try starting `retroarch-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
|
||||
```
|
||||
|
||||
### Running Kodi web service on a privileged port
|
||||
Users wishing to run the kodi web service on a privileged port (i.e. <1024) can simply use a [systemd drop-in](https://wiki.archlinux.org/index.php/Systemd#Drop-in_files) modification as follows:
|
||||
```
|
||||
[Service]
|
||||
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
||||
```
|
||||
|
@ -1,3 +1,3 @@
|
||||
# arm
|
||||
|
||||
These files are used for Arch ARM's kodi packages only.
|
||||
These files are used for Arch ARM's retroarch packages only.
|
||||
|
@ -1,46 +0,0 @@
|
||||
.\" Text automatically generated by txt2man
|
||||
.TH kodi.service 1 "23 May 2021" "" ""
|
||||
.SH NAME
|
||||
\fBkodi.service \fP- Systemd service unit to run Kodi in standalone mode without the need for a DE.
|
||||
\fB
|
||||
.SH DESCRIPTION
|
||||
|
||||
.SH NOTES ON SYSTEM SHUTDOWN/REBOOT
|
||||
Be aware that this service runs Kodi in systemd's user.slice not in the system.slice. In order to have Kodi gracefully exit, the system should be called to shutdown or to reboot using the respective Kodi actions not by a call to systemctl.
|
||||
.PP
|
||||
This is NOT recommended:
|
||||
.PP
|
||||
.nf
|
||||
.fam C
|
||||
# systemctl reboot
|
||||
|
||||
.fam T
|
||||
.fi
|
||||
If you do reboot or shutdown via a call to systemctl, this will result in systemd killing the cg too quickly and data loss to your Kodi profile will occur. When Kodi exits cleanly, it will save GUI settings, media settings, Kodi uptime etc. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run Kodi in systemd's system.slice instead, doing so makes it difficult to use USB mounts within Kodi and to use pulseaudio for Kodi sessions.
|
||||
.SH RECOMMENDED METHODS TO SHUTDOWN/REBOOT
|
||||
Here are several options:
|
||||
.IP \(bu 3
|
||||
Select the corresponding option under Power menu in the Kodi GUI.
|
||||
.IP \(bu 3
|
||||
Use the official Android/iOS remote app.
|
||||
.IP \(bu 3
|
||||
If a CLI option is preferred, use kodi-send to issue the command to reboot or shutdown like so:
|
||||
.PP
|
||||
.nf
|
||||
.fam C
|
||||
$ kodi-send -a "Reboot"
|
||||
$ kodi-send -a "ShutDown()"
|
||||
|
||||
.fam T
|
||||
.fi
|
||||
Note that kodi-send is provided by the kodi-xxx-eventclients package where xxx is either, rpi, rpi-legacy, or git depending on which package group you installed.
|
||||
.SH PASSING ENVIRONMENT VARIABLES TO THE SERVICE
|
||||
Certain use cases require environment variables to be passed to the service. Define these variables in /etc/conf.d/kodi-standalone and they will be passed along to the service.
|
||||
.SH CONTRIBUTE
|
||||
Users wishing to contribute to this code, should fork and send a pull request. Source is freely available on the project page linked below.
|
||||
.SH BUGS
|
||||
Discover a bug? Please open an issue on the project page linked below.
|
||||
.SH ONLINE
|
||||
Project page: https://github.com/graysky2/kodi-standalone-service
|
||||
.SH AUTHOR
|
||||
graysky (graysky AT archlinux DOT us)
|
@ -1,30 +1,19 @@
|
||||
NAME
|
||||
kodi.service - Systemd service unit to run Kodi in standalone mode without the need for a DE.
|
||||
retroarch.service - Systemd service unit to run RetroArch in standalone mode without the need for a DE.
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
NOTES ON SYSTEM SHUTDOWN/REBOOT
|
||||
Be aware that this service runs Kodi in systemd's system.slice not in the user.slice. In order to have Kodi gracefully exit, the system should be called to shutdown or to reboot using the respective Kodi actions not by a call to systemctl.
|
||||
Be aware that this service runs RetroArch in systemd's system.slice not in the user.slice. In order to have RetroArch gracefully exit, the system should be called to shutdown or to reboot using the respective RetroArch actions not by a call to systemctl.
|
||||
|
||||
This is NOT recommended:
|
||||
|
||||
# systemctl reboot
|
||||
|
||||
If you do reboot or shutdown via a call to systemctl, this will result in systemd killing the cg too quickly and data loss to your Kodi profile will occur. When Kodi exits cleanly, it will save GUI settings, media settings, Kodi uptime etc. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run Kodi in systemd's user.slice instead, doing so makes it difficult to use USB mounts within Kodi and to use pulseaudio for Kodi sessions.
|
||||
|
||||
RECOMMENDED METHODS TO SHUTDOWN/REBOOT
|
||||
Here are several options:
|
||||
o Select the corresponding option under Power menu in the Kodi GUI.
|
||||
o Use the official Android/iOS remote app.
|
||||
o If a CLI option is preferred, use kodi-send to issue the command to reboot or shutdown like so:
|
||||
|
||||
$ kodi-send -a "Reboot"
|
||||
$ kodi-send -a "ShutDown()"
|
||||
|
||||
Note that kodi-send is provided by the kodi-xxx-eventclients package where xxx is either, rpi, rpi-legacy, or git depending on which package group you installed.
|
||||
If you do reboot or shutdown via a call to systemctl, this will result in systemd killing the cg too quickly and data loss to your RetroArch profile will occur. When RetroArch exits cleanly, it will save GUI settings, media settings, RetroArch uptime etc. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run RetroArch in systemd's user.slice instead, doing so makes it difficult to use USB mounts within RetroArch and to use pulseaudio for RetroArch sessions.
|
||||
|
||||
PASSING ENVIRONMENT VARIABLES TO THE SERVICE
|
||||
Certain use cases require environment variables to be passed to the service. Define these variables in /etc/conf.d/kodi-standalone and they will be passed along to the service.
|
||||
Certain use cases require environment variables to be passed to the service. Define these variables in /etc/conf.d/retroarch-standalone and they will be passed along to the service.
|
||||
|
||||
CONTRIBUTE
|
||||
Users wishing to contribute to this code, should fork and send a pull request. Source is freely available on the project page linked below.
|
||||
@ -33,7 +22,7 @@ BUGS
|
||||
Discover a bug? Please open an issue on the project page linked below.
|
||||
|
||||
ONLINE
|
||||
Project page: https://github.com/graysky2/kodi-standalone-service
|
||||
Project page: https://git.jeroened.be/JeroenED/retroarch-standalone-service
|
||||
|
||||
AUTHOR
|
||||
graysky (graysky AT archlinux DOT us)
|
||||
|
29
arm/doc/retroarch.service.1
Normal file
29
arm/doc/retroarch.service.1
Normal file
@ -0,0 +1,29 @@
|
||||
.\" Text automatically generated by txt2man
|
||||
.TH untitled "19 September 2022" "" ""
|
||||
.SH NAME
|
||||
\fBretroarch.service \fP- Systemd service unit to run RetroArch in standalone mode without the need for a DE.
|
||||
\fB
|
||||
.SH DESCRIPTION
|
||||
|
||||
.SH NOTES ON SYSTEM SHUTDOWN/REBOOT
|
||||
Be aware that this service runs RetroArch in systemd's system.slice not in the user.slice. In order to have RetroArch gracefully exit, the system should be called to shutdown or to reboot using the respective RetroArch actions not by a call to systemctl.
|
||||
.PP
|
||||
This is NOT recommended:
|
||||
.PP
|
||||
.nf
|
||||
.fam C
|
||||
# systemctl reboot
|
||||
|
||||
.fam T
|
||||
.fi
|
||||
If you do reboot or shutdown via a call to systemctl, this will result in systemd killing the cg too quickly and data loss to your RetroArch profile will occur. When RetroArch exits cleanly, it will save GUI settings, media settings, RetroArch uptime etc. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run RetroArch in systemd's user.slice instead, doing so makes it difficult to use USB mounts within RetroArch and to use pulseaudio for RetroArch sessions.
|
||||
.SH PASSING ENVIRONMENT VARIABLES TO THE SERVICE
|
||||
Certain use cases require environment variables to be passed to the service. Define these variables in /etc/conf.d/retroarch-standalone and they will be passed along to the service.
|
||||
.SH CONTRIBUTE
|
||||
Users wishing to contribute to this code, should fork and send a pull request. Source is freely available on the project page linked below.
|
||||
.SH BUGS
|
||||
Discover a bug? Please open an issue on the project page linked below.
|
||||
.SH ONLINE
|
||||
Project page: https://git.jeroened.be/JeroenED/retroarch-standalone-service
|
||||
.SH AUTHOR
|
||||
graysky (graysky AT archlinux DOT us)
|
@ -1,17 +1,17 @@
|
||||
[Unit]
|
||||
Description=Kodi standalone (GBM)
|
||||
Description=RetroArch standalone (GBM)
|
||||
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
|
||||
Wants=network-online.target polkit.service upower.service
|
||||
Conflicts=getty@tty1.service
|
||||
|
||||
[Service]
|
||||
User=kodi
|
||||
Group=kodi
|
||||
EnvironmentFile=-/etc/conf.d/kodi-standalone
|
||||
User=retroarch
|
||||
Group=retroarch
|
||||
EnvironmentFile=-/etc/conf.d/retroarch-standalone
|
||||
PAMName=login
|
||||
TTYPath=/dev/tty1
|
||||
ExecStart=/usr/bin/kodi-standalone
|
||||
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
|
||||
ExecStart=/usr/bin/retroarch
|
||||
ExecStop=/usr/bin/killall --user retroarch --exact --wait retroarch
|
||||
Restart=on-abort
|
||||
StandardInput=tty
|
||||
StandardOutput=journal
|
@ -1,16 +1,16 @@
|
||||
# override these settings by copying this to /etc/sysusers.d/ and modifying it therein
|
||||
|
||||
# Type Name ID GECOS Home directory Shell
|
||||
g kodi - -
|
||||
u kodi - "Kodi User" /var/lib/kodi
|
||||
g retroarch - -
|
||||
u retroarch - "RetroArch User" /var/lib/retroarch
|
||||
|
||||
# supplemental groups
|
||||
m kodi audio
|
||||
m kodi input
|
||||
m kodi video
|
||||
m kodi disk
|
||||
m kodi network
|
||||
m kodi optical
|
||||
m kodi power
|
||||
m kodi storage
|
||||
m kodi tty
|
||||
m retroarch audio
|
||||
m retroarch input
|
||||
m retroarch video
|
||||
m retroarch disk
|
||||
m retroarch network
|
||||
m retroarch optical
|
||||
m retroarch power
|
||||
m retroarch storage
|
||||
m retroarch tty
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Type Path Mode User Group Age Argument
|
||||
d /var/lib/kodi 0750 kodi kodi - -
|
||||
Z /var/lib/kodi - kodi kodi - -
|
||||
d /var/lib/retroarch 0750 retroarch retroarch - -
|
||||
Z /var/lib/retroarch - retroarch retroarch - -
|
||||
|
@ -1,5 +1,5 @@
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (subject.user == "kodi") {
|
||||
if (subject.user == "retroarch") {
|
||||
polkit.log("action=" + action);
|
||||
polkit.log("subject=" + subject);
|
||||
if (action.id.indexOf("org.freedesktop.login1.") == 0) {
|
||||
|
@ -1,54 +0,0 @@
|
||||
.\" Text automatically generated by txt2man
|
||||
.TH kodi.service 1 "23 May 2021" "" ""
|
||||
.SH NAME
|
||||
\fBkodi-xxx.service \fP- Systemd service units to run Kodi in standalone mode without the need for a DE.
|
||||
\fB
|
||||
.SH DESCRIPTION
|
||||
Systemd service units to run kodi in standalone mode using X11, GBM, or Wayland.
|
||||
.PP
|
||||
Provided services are:
|
||||
.IP \(bu 3
|
||||
/usr/lib/systemd/system/kodi-x11.service
|
||||
.IP \(bu 3
|
||||
/usr/lib/systemd/system/kodi-gbm.service
|
||||
.IP \(bu 3
|
||||
/usr/lib/systemd/system/kodi-wayland.service
|
||||
.SH NOTES ON SYSTEM SHUTDOWN/REBOOT
|
||||
Be aware that these services run Kodi in systemd's system.slice not in the user.slice. In order to have Kodi gracefully exit, the system should be called to shutdown or to reboot using the respective Kodi actions not by a call to systemctl.
|
||||
.PP
|
||||
This is NOT recommended:
|
||||
.PP
|
||||
.nf
|
||||
.fam C
|
||||
# systemctl reboot
|
||||
|
||||
.fam T
|
||||
.fi
|
||||
If you do reboot or shutdown via a call to systemctl, this will result in systemd killing the cg too quickly and data loss to your Kodi profile will occur. When Kodi exits cleanly, it will save GUI settings, media settings, Kodi uptime etc. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run Kodi in systemd's user.slice instead, doing so makes it difficult to use USB mounts within Kodi and to use pulseaudio for Kodi sessions.
|
||||
.SH RECOMMENDED METHODS TO SHUTDOWN/REBOOT
|
||||
Here are several options:
|
||||
.IP \(bu 3
|
||||
Select the corresponding option under Power menu in the Kodi GUI.
|
||||
.IP \(bu 3
|
||||
Use the official Android/iOS remote app.
|
||||
.IP \(bu 3
|
||||
If a CLI option is preferred, use kodi-send to issue the command to reboot or shutdown like so:
|
||||
.PP
|
||||
.nf
|
||||
.fam C
|
||||
$ kodi-send -a "Reboot"
|
||||
$ kodi-send -a "ShutDown()"
|
||||
|
||||
.fam T
|
||||
.fi
|
||||
Note that kodi-send may not be included with your Distro's kodi package. For example, on Arch Linux, it is provided by the kodi-eventclients package.
|
||||
.SH PASSING ENVIRONMENT VARIABLES TO THE SERVICE
|
||||
Certain use cases require environment variables to be passed to the service. Define these variables in /etc/conf.d/kodi-standalone and they will be passed along to the service.
|
||||
.SH CONTRIBUTE
|
||||
Users wishing to contribute to this code, should fork and send a pull request. Source is freely available on the project page linked below.
|
||||
.SH BUGS
|
||||
Discover a bug? Please open an issue on the project page linked below.
|
||||
.SH ONLINE
|
||||
Project page: https://github.com/graysky2/kodi-standalone-service
|
||||
.SH AUTHOR
|
||||
graysky (graysky AT archlinux DOT us)
|
87
x86/doc/retroarch.service.1
Normal file
87
x86/doc/retroarch.service.1
Normal file
@ -0,0 +1,87 @@
|
||||
.\" Text automatically generated by txt2man
|
||||
.TH untitled "19 September 2022" "" ""
|
||||
.RS
|
||||
# retroarch-standalone-service
|
||||
.PP
|
||||
(fork of [Kodi Standalone \fBService]\fP(https://github.com/graysky2/kodi-standalone-service) by GraySky2)
|
||||
.TP
|
||||
.B
|
||||
Run [RetroArch](https://retroarch.com/) as an unprivileged user in standalone mode without the need for a full Desktop Environment.
|
||||
X11, Wayland, and GBM are supported.
|
||||
.PP
|
||||
Which one to choose?
|
||||
.TP
|
||||
.B
|
||||
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 retroarch'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 [RetroArch issue \fB14876]\fP(https://github.com/xbmc/xbmc/issues/14876).
|
||||
.PP
|
||||
Another factor that may affect choice is the number of dependencies required to run which will vary distro-to-distro.
|
||||
.PP
|
||||
## Installation
|
||||
### Arch Linux
|
||||
Arch Linux users (likely users of Arch clones) can find a PKGBUILD in the [AUR](https://aur.archlinux.org/packages/kodi-standalone-service) that will take care of everything. Simply install and use.
|
||||
.PP
|
||||
### Other distros/manual installation
|
||||
.TP
|
||||
.B
|
||||
Users of other distros can just run `make install` as the root user.
|
||||
Then, as the root user, run:
|
||||
.IP \(bu 3
|
||||
`systemd-sysusers`
|
||||
.IP \(bu 3
|
||||
`systemd-tmpfiles \fB--create\fP`
|
||||
.PP
|
||||
Note that the retroarch user's home directory is `/var/lib/retroarch/` in this example, NOT `/home/retroarch/` like a regular user.
|
||||
.PP
|
||||
### Dependencies
|
||||
.TP
|
||||
.B
|
||||
Note that I list some dependencies below that the Arch package already has listed as dependencies.
|
||||
This is to help users of other distros whose retroarch packages may not have these listed. If you're installing this from the AUR package listed above, just pay attention to pacman's post-install message which calls out the Arch-specific `optdepends` needed for the various service files to work.
|
||||
.IP \(bu 3
|
||||
retroarch (>=19.1 on Arch Linux, lower versions may work with other distros)
|
||||
.IP \(bu 3
|
||||
cage, libinput, and xorg-xwayland (for running wayland)
|
||||
.IP \(bu 3
|
||||
libinput (for running gbm)
|
||||
.IP \(bu 3
|
||||
xorg-server and xorg-xinit (for running x11)
|
||||
.PP
|
||||
#### Notes for users of non-Arch Linux distros
|
||||
.IP 1. 4
|
||||
Users of Ubuntu ≥20.0 will need to edit `/etc/sysusers.d/retroarch-standalone.conf` and uncomment the line adding retroarch user to the `render` group.
|
||||
.IP 2. 4
|
||||
Users of Ubuntu wishing the retroarch user to access devices on `/dev/ttyxxxx`, will need to edit `/etc/sysusers.d/retroarch-standalone.conf` and uncomment the line adding the retroarch user to the `dialout` group.
|
||||
.PP
|
||||
#### Notes for Users of RPiOS
|
||||
To use this with RPiOS requires a few extra steps.
|
||||
.IP 1. 4
|
||||
Set the boot preference to boot to the console, see https://github.com/graysky2/kodi-standalone-service/issues/37
|
||||
.TP
|
||||
.B
|
||||
2. Replace `/usr/bin/retroarch` with vanilla upstream's version.
|
||||
See [here](https://github.com/graysky2/kodi-standalone-service/files/7888328/retroarch.txt) for an example that is known to work with RPiOS as of Matrix-19.3.
|
||||
.PP
|
||||
## Usage
|
||||
Simply [start/enable](https://wiki.archlinux.org/index.php/Systemd#Using_units) the requisite service.
|
||||
.PP
|
||||
## Passing environment variables to the service
|
||||
Certain use cases require environment variables to be passed to the service. Define these variables in `/etc/conf.d/retroarch-standalone` and they will be passed along to the service.
|
||||
.PP
|
||||
## Notes on system shutdown/reboot
|
||||
.TP
|
||||
.B
|
||||
Be aware that these services run RetroArch in systemd's user.slice not in the system.slice.
|
||||
In order to have RetroArch gracefully exit, the system should be called to shutdown or to reboot using the respective RetroArch actions not by a call to systemctl. Failure to do so will result in an ungraceful exit of RetroArch and the saving of GUI settings, RetroArch uptime etc. will not occur. In principal this is no different than data loss occurring from a user doing work when a sysadmin issues a reboot command without prior warning. While it is possible to run RetroArch in systemd's system.slice instead, doing so makes it difficult to use USB mounts within RetroArch and to use pulseaudio for RetroArch sessions.
|
||||
.PP
|
||||
## Acknowledgments
|
||||
Much of the credit for this service goes to the Arch Linux maintainers of the official retroarch package. Note that they removed it upon the [1.16-1 release of \fBXorg]\fP(https://git.archlinux.org/svntogit/community.git/commit/trunk?h=packages/xbmc&id=9763c6d32678f3a3f45c195bfae92eee209d504f).
|
||||
.PP
|
||||
## Tips and Tricks
|
||||
### Service not starting
|
||||
Most users should not need `/etc/X11/Xwrapper.config` since the created X server becomes the [controlling \fBprocess]\fP(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.
|
||||
.PP
|
||||
The recommendation is to first try starting `retroarch-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
|
||||
```
|
@ -1,18 +1,18 @@
|
||||
[Unit]
|
||||
Description=Kodi standalone (GBM)
|
||||
Description=RetroArch standalone (GBM)
|
||||
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
|
||||
Wants=network-online.target polkit.service upower.service
|
||||
Conflicts=getty@tty1.service
|
||||
|
||||
[Service]
|
||||
User=kodi
|
||||
Group=kodi
|
||||
EnvironmentFile=-/etc/conf.d/kodi-standalone
|
||||
User=retroarch
|
||||
Group=retroarch
|
||||
EnvironmentFile=-/etc/conf.d/retroarch-standalone
|
||||
SupplementaryGroups=input
|
||||
PAMName=login
|
||||
TTYPath=/dev/tty1
|
||||
ExecStart=/usr/bin/kodi-standalone
|
||||
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
|
||||
ExecStart=/usr/bin/retroarch
|
||||
ExecStop=/usr/bin/killall --user retroarch --exact --wait retroarch
|
||||
Restart=on-abort
|
||||
StandardInput=tty
|
||||
StandardOutput=journal
|
@ -1,19 +1,19 @@
|
||||
[Unit]
|
||||
Description=Kodi standalone (Wayland)
|
||||
Description=RetroArch standalone (Wayland)
|
||||
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
|
||||
Wants=network-online.target polkit.service upower.service
|
||||
Conflicts=getty@tty1.service
|
||||
|
||||
[Service]
|
||||
User=kodi
|
||||
Group=kodi
|
||||
RuntimeDirectory=kodi
|
||||
Environment="XDG_RUNTIME_DIR=%t/kodi"
|
||||
EnvironmentFile=-/etc/conf.d/kodi-standalone
|
||||
User=retroarch
|
||||
Group=retroarch
|
||||
RuntimeDirectory=retroarch
|
||||
Environment="XDG_RUNTIME_DIR=%t/retroarch"
|
||||
EnvironmentFile=-/etc/conf.d/retroarch-standalone
|
||||
PAMName=login
|
||||
TTYPath=/dev/tty1
|
||||
ExecStart=/usr/bin/cage -- /usr/bin/kodi-standalone
|
||||
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
|
||||
ExecStart=/usr/bin/cage -- /usr/bin/retroarch
|
||||
ExecStop=/usr/bin/killall --user retroarch --exact --wait retroarch
|
||||
Restart=on-abort
|
||||
StandardInput=tty
|
||||
StandardOutput=journal
|
@ -1,17 +1,17 @@
|
||||
[Unit]
|
||||
Description=Kodi standalone (X11)
|
||||
Description=RetroArch standalone (X11)
|
||||
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target sound.target bluetooth.target polkit.service upower.service mysqld.service lircd.service
|
||||
Wants=network-online.target polkit.service upower.service
|
||||
Conflicts=getty@tty1.service
|
||||
|
||||
[Service]
|
||||
User=kodi
|
||||
Group=kodi
|
||||
EnvironmentFile=-/etc/conf.d/kodi-standalone
|
||||
User=retroarch
|
||||
Group=retroarch
|
||||
EnvironmentFile=-/etc/conf.d/retroarch-standalone
|
||||
PAMName=login
|
||||
TTYPath=/dev/tty1
|
||||
ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1
|
||||
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
|
||||
ExecStart=/usr/bin/xinit /usr/bin/retroarch -- :0 -quiet -nolisten tcp vt1
|
||||
ExecStop=/usr/bin/killall --user retroarch --exact --wait retroarch
|
||||
Restart=on-abort
|
||||
StandardInput=tty
|
||||
StandardOutput=journal
|
@ -1,26 +1,26 @@
|
||||
# override these settings by copying this to /etc/sysusers.d/ and modifying it therein
|
||||
|
||||
# Type Name ID GECOS Home directory Shell
|
||||
g kodi - -
|
||||
u kodi - "Kodi User" /var/lib/kodi
|
||||
g retroarch - -
|
||||
u retroarch - "RetroArch User" /var/lib/retroarch
|
||||
|
||||
# supplemental groups
|
||||
m kodi audio
|
||||
m kodi optical
|
||||
m kodi video
|
||||
m retroarch audio
|
||||
m retroarch optical
|
||||
m retroarch video
|
||||
|
||||
# other groups, see: /usr/lib/sysusers.d/arch.conf or basic.conf
|
||||
# m kodi network
|
||||
# m kodi power
|
||||
# m kodi tty
|
||||
# m kodi disk
|
||||
# m kodi storage
|
||||
# m retroarch network
|
||||
# m retroarch power
|
||||
# m retroarch tty
|
||||
# m retroarch disk
|
||||
# m retroarch storage
|
||||
|
||||
# Ubuntu users only
|
||||
# uncomment the following line if the kodi user needs access to /etc/ttyxxxx
|
||||
# uncomment the following line if the retroarch user needs access to /etc/ttyxxxx
|
||||
# https://github.com/graysky2/kodi-standalone-service/issues/14
|
||||
# m kodi dialout
|
||||
# m retroarch dialout
|
||||
|
||||
# uncomment the following line if you're running Ubuntu >=20 since they created
|
||||
# a new render group of which the kodi user needs to be a member
|
||||
# m kodi render
|
||||
# a new render group of which the retroarch user needs to be a member
|
||||
# m retroarch render
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Type Path Mode User Group Age Argument
|
||||
d /var/lib/kodi 0750 kodi kodi - -
|
||||
Z /var/lib/kodi - kodi kodi - -
|
||||
d /var/lib/retroarch 0750 retroarch retroarch - -
|
||||
Z /var/lib/retroarch - retroarch retroarch - -
|
||||
|
Loading…
Reference in New Issue
Block a user