add files for Arch ARM

streamline maintenance of Arch ARM packages/single source of files
This commit is contained in:
graysky 2021-04-03 03:49:41 -04:00
parent 3a9cabe54f
commit 44ed658e1b
9 changed files with 148 additions and 3 deletions

View File

@ -11,9 +11,6 @@ Another factor that may affect choice is the number of dependencies required to
### Arch Linux
Arch Linux users 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.
### ARM distros
Users of ARM distros such as Arch ARM, Raspberry Pi OS (formerly Raspbian), etc. should NOT use these files since their official corresponding kodi packages supply their own version of a service. If you are knowledgeable enough with your distro, feel free to use/modify.
### 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.

3
arm/README.md Normal file
View File

@ -0,0 +1,3 @@
# arm
These files are used for Arch ARM's kodi packages only.

46
arm/doc/kodi.service.1 Normal file
View File

@ -0,0 +1,46 @@
.\" Text automatically generated by txt2man
.TH kodi.service 1 "13 March 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
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.
.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)

39
arm/doc/manpage.txt Normal file
View File

@ -0,0 +1,39 @@
NAME
kodi.service - Systemd service unit to run Kodi 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 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.
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 system.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.
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.
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.
BUGS
Discover a bug? Please open an issue on the project page linked below.
ONLINE
Project page: https://github.com/graysky2/kodi-standalone-service
AUTHOR
graysky (graysky AT archlinux DOT us)

21
arm/init/kodi.service Normal file
View File

@ -0,0 +1,21 @@
[Unit]
Description=Kodi 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
Wants=network-online.target polkit.service upower.service
Conflicts=getty@tty1.service
[Service]
User=kodi
Group=kodi
EnvironmentFile=-/etc/conf.d/kodi-standalone
PAMName=login
TTYPath=/dev/tty1
Environment=WINDOWING=gbm
ExecStart=/usr/bin/kodi-standalone
ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin
Restart=on-abort
StandardInput=tty
StandardOutput=journal
[Install]
Alias=display-manager.service

16
arm/init/sysusers.conf Normal file
View File

@ -0,0 +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
# 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

3
arm/init/tmpfiles.conf Normal file
View File

@ -0,0 +1,3 @@
# Type Path Mode User Group Age Argument
d /var/lib/kodi 0750 kodi kodi - -
Z /var/lib/kodi - kodi kodi - -

15
arm/polkit/polkit.rules Normal file
View File

@ -0,0 +1,15 @@
polkit.addRule(function(action, subject) {
if (subject.user == "kodi") {
polkit.log("action=" + action);
polkit.log("subject=" + subject);
if (action.id.indexOf("org.freedesktop.login1.") == 0) {
return polkit.Result.YES;
}
if (action.id.indexOf("org.freedesktop.udisks.") == 0) {
return polkit.Result.YES;
}
if (action.id.indexOf("org.freedesktop.udisks2.") == 0) {
return polkit.Result.YES;
}
}
});

5
arm/udev/99-kodi.rules Normal file
View File

@ -0,0 +1,5 @@
SUBSYSTEM=="vc-sm",GROUP="video",MODE="0660"
SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"
SUBSYSTEM=="tty", KERNEL=="tty[0-9]*", GROUP="tty", MODE="0660"
SUBSYSTEM=="dma_heap", KERNEL=="linux*", GROUP="video", MODE="0660"
SUBSYSTEM=="dma_heap", KERNEL=="system", GROUP="video", MODE="0660"