diff --git a/README.md b/README.md index 6fdbfa6..5afec04 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ Users of other distros should install the following files: * `init/*.service` to `/usr/lib/systemd/system/` * `init/sysusers.conf` to `/usr/lib/sysusers.d/`, then run `systemd-sysusers` * `init/tmpfiles.conf` to `/usr/lib/tmpfiles.d/`, then run `systemd-tmpfiles --create` +* `polkit/10-kodi.rules` to `/usr/share/polkit-1/rules.d/`, then run `udevadm control --reload-rules && udevadm trigger` Note that the kodi user's home directory is `/var/lib/kodi/` in this example, NOT `/home/kodi/` like a regular user. diff --git a/init/kodi-gbm.service b/init/kodi-gbm.service index eb6e81d..424829d 100644 --- a/init/kodi-gbm.service +++ b/init/kodi-gbm.service @@ -1,6 +1,6 @@ [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 +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 @@ -9,7 +9,6 @@ User=kodi Group=kodi EnvironmentFile=-/etc/conf.d/kodi-standalone SupplementaryGroups=input -PAMName=login TTYPath=/dev/tty1 Environment=WINDOWING=gbm ExecStart=/usr/bin/kodi-standalone diff --git a/init/kodi-wayland.service b/init/kodi-wayland.service index 091fe89..6108256 100644 --- a/init/kodi-wayland.service +++ b/init/kodi-wayland.service @@ -1,6 +1,6 @@ [Unit] Description=Kodi 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 +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 @@ -8,7 +8,6 @@ Conflicts=getty@tty1.service User=kodi Group=kodi EnvironmentFile=-/etc/conf.d/kodi-standalone -PAMName=login TTYPath=/dev/tty1 Environment=WINDOWING=wayland ExecStart=/usr/bin/cage -- /usr/bin/kodi-standalone diff --git a/init/kodi-x11.service b/init/kodi-x11.service index 26774ab..2d2218a 100644 --- a/init/kodi-x11.service +++ b/init/kodi-x11.service @@ -1,6 +1,6 @@ [Unit] Description=Kodi 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 +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 @@ -8,7 +8,6 @@ Conflicts=getty@tty1.service User=kodi Group=kodi EnvironmentFile=-/etc/conf.d/kodi-standalone -PAMName=login TTYPath=/dev/tty1 Environment=WINDOWING=x11 ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1 @@ -16,6 +15,11 @@ 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 diff --git a/init/sysusers.conf b/init/sysusers.conf index a70df4d..5b0837f 100644 --- a/init/sysusers.conf +++ b/init/sysusers.conf @@ -5,11 +5,19 @@ g kodi - - u kodi - "Kodi User" /var/lib/kodi # supplemental groups +# see: https://wiki.archlinux.org/index.php/Users_and_groups#Pre-systemd_groups m kodi audio +m kodi input m kodi optical -m kodi uucp m kodi 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 + # uncomment the following line for Ubunutu users needing access to /etc/ttyxxxx # https://github.com/graysky2/kodi-standalone-service/issues/14 # m kodi dialout diff --git a/polkit/10-kodi.rules b/polkit/10-kodi.rules new file mode 100644 index 0000000..bcf7abf --- /dev/null +++ b/polkit/10-kodi.rules @@ -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; + } + } +});