[RFC,1/2] seatd: add recipe

Message ID 20220201133054.3265186-1-alex@linutronix.de
State Accepted, archived
Commit f0c7e8cdeea065ddfcd4187f1fabc074b2753ba1
Headers show
Series [RFC,1/2] seatd: add recipe | expand

Commit Message

Alexander Kanavin Feb. 1, 2022, 1:30 p.m. UTC
This is needed to run weston properly as non-root in the absence
of systemd-logind, and other compositors will likely require seatd
as well.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/conf/distro/include/maintainers.inc |  1 +
 meta/recipes-core/seatd/seatd/init       | 45 ++++++++++++++++++++++++
 meta/recipes-core/seatd/seatd_0.6.3.bb   | 29 +++++++++++++++
 3 files changed, 75 insertions(+)
 create mode 100644 meta/recipes-core/seatd/seatd/init
 create mode 100644 meta/recipes-core/seatd/seatd_0.6.3.bb

Comments

Denys Dmytriyenko Feb. 1, 2022, 5:15 p.m. UTC | #1
On Tue, Feb 01, 2022 at 02:30:54PM +0100, Alexander Kanavin wrote:
> Upstream has deprecated both weston-launch and fbdev backend, so let's
> not delay the inevitable and find replacements.
> 
> Fbdev can be replaced by passing --use-pixman to drm backend;
> this will bypass the opengl paths and use CPU for rendering.
> Apply where GL is too slow or unavailable.
> 
> weston-launch can be replaced by starting weston directly, with
> a seat management daemon for support. This is provided either
> by systemd, or on systemd-less systems, by seatd. The sysvinit
> startup scripts and tests have been rewritten accordingly. Bonus
> fix: under sysvinit weston now starts under weston user as it should,
> and not under root.

Thanks, Alex, for working on this big upgrade ahead of schedule!

Just to make it clear to everyone else on the list - this is not the final 
10.0.0 release, but rather an RC1 that is versioned as 9.0.93, hence the RFC 
status of the patch, just for review.

And this would definitely require extra testing on different actual platforms, 
as I'm a bit worried about root-less execution...
Ross Burton Feb. 1, 2022, 5:39 p.m. UTC | #2
On Tue, 1 Feb 2022 at 13:31, Alexander Kanavin <alex.kanavin@gmail.com> wrote:
> weston-launch can be replaced by starting weston directly, with
> a seat management daemon for support. This is provided either
> by systemd, or on systemd-less systems, by seatd. The sysvinit
> startup scripts and tests have been rewritten accordingly. Bonus
> fix: under sysvinit weston now starts under weston user as it should,
> and not under root.

Awesome, thanks!

Ross
Alexander Kanavin Feb. 1, 2022, 5:41 p.m. UTC | #3
On Tue, 1 Feb 2022 at 18:25, Daniel Stone <daniel.stone@collabora.com>
wrote:

> Most systems use Weston's logind backend with systemd integration;
> OE/Yocto was the last system I know of using the old weston-launch
> wrapper.
>

weston-launch was used in yocto only for sysvinit based images; systemd
images have used direct rootless weston unit like everyone else for a while
now. So it's reasonably well tested here too.

Alex
Denys Dmytriyenko Feb. 2, 2022, 12:27 a.m. UTC | #4
On Tue, Feb 01, 2022 at 12:15:01PM -0500, Denys Dmytriyenko wrote:
> On Tue, Feb 01, 2022 at 02:30:54PM +0100, Alexander Kanavin wrote:
> Just to make it clear to everyone else on the list - this is not the final 
> 10.0.0 release, but rather an RC1 that is versioned as 9.0.93, hence the RFC 
> status of the patch, just for review.

BTW, the final 10.0.0 just got released earlier today:
https://lists.freedesktop.org/archives/wayland-devel/2022-February/042103.html

Alex,

Would it be possible to includue the link above with the full Changelog in the 
commit message? Thanks.
Alexander Kanavin Feb. 2, 2022, 6:29 p.m. UTC | #5
On Wed, 2 Feb 2022 at 01:27, Denys Dmytriyenko <denis@denix.org> wrote:

>
> BTW, the final 10.0.0 just got released earlier today:
>
> https://lists.freedesktop.org/archives/wayland-devel/2022-February/042103.html
>
> Alex,
>
> Would it be possible to includue the link above with the full Changelog in
> the
> commit message? Thanks.
>

Yes; I just sent the final update in the latest patchset.

Alex

Patch

diff --git a/meta/conf/distro/include/maintainers.inc b/meta/conf/distro/include/maintainers.inc
index ae25287c11..cb289a0eee 100644
--- a/meta/conf/distro/include/maintainers.inc
+++ b/meta/conf/distro/include/maintainers.inc
@@ -684,6 +684,7 @@  RECIPE_MAINTAINER:pn-rxvt-unicode = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-sato-screenshot = "Ross Burton <ross.burton@arm.com>"
 RECIPE_MAINTAINER:pn-sbc = "Unassigned <unassigned@yoctoproject.org>"
 RECIPE_MAINTAINER:pn-screen = "Anuj Mittal <anuj.mittal@intel.com>"
+RECIPE_MAINTAINER:pn-seatd = "Alexander Kanavin <alex.kanavin@gmail.com>"
 RECIPE_MAINTAINER:pn-sed = "Chen Qi <Qi.Chen@windriver.com>"
 RECIPE_MAINTAINER:pn-serf = "Anuj Mittal <anuj.mittal@intel.com>"
 RECIPE_MAINTAINER:pn-setserial = "Yi Zhao <yi.zhao@windriver.com>"
diff --git a/meta/recipes-core/seatd/seatd/init b/meta/recipes-core/seatd/seatd/init
new file mode 100644
index 0000000000..0589c765ac
--- /dev/null
+++ b/meta/recipes-core/seatd/seatd/init
@@ -0,0 +1,45 @@ 
+#!/bin/sh
+#
+### BEGIN INIT INFO
+# Provides: seatd
+# Required-Start: $local_fs $remote_fs
+# Required-Stop: $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+### END INIT INFO
+
+killproc() {
+        pid=`/bin/pidof $1`
+        [ "$pid" != "" ] && kill $pid
+}
+
+case "$1" in
+  start)
+        seatd -g video -n 1 > /tmp/seatd-start-notify &
+        [ -s /tmp/seatd-start-notify ] && exit 0
+        sleep 0.1
+        [ -s /tmp/seatd-start-notify ] && exit 0
+        sleep 0.5
+        [ -s /tmp/seatd-start-notify ] && exit 0
+        sleep 5
+        [ -s /tmp/seatd-start-notify ] && exit 0
+        exit 1
+  ;;
+
+  stop)
+        echo "Stopping seatd"
+        killproc seatd
+  ;;
+
+  restart)
+	$0 stop
+        sleep 1
+        $0 start
+  ;;
+
+  *)
+        echo "usage: $0 { start | stop | restart }"
+  ;;
+esac
+
+exit 0
diff --git a/meta/recipes-core/seatd/seatd_0.6.3.bb b/meta/recipes-core/seatd/seatd_0.6.3.bb
new file mode 100644
index 0000000000..0e1a79dddf
--- /dev/null
+++ b/meta/recipes-core/seatd/seatd_0.6.3.bb
@@ -0,0 +1,29 @@ 
+SUMMARY = "A minimal seat management daemon, and a universal seat management library."
+DESCRIPTION = "Seat management takes care of mediating access to shared devices (graphics, input), without requiring the applications needing access to be root."
+HOMEPAGE = "https://git.sr.ht/~kennylevinsen/seatd"
+
+LICENSE = "MIT"
+
+LIC_FILES_CHKSUM = "file://LICENSE;md5=715a99d2dd552e6188e74d4ed2914d5a"
+
+SRC_URI = "git://git.sr.ht/~kennylevinsen/seatd;protocol=https;branch=master \
+           file://init"
+SRCREV = "88db55f6068c1c01d85b61aa6adff0a6b2a8dce8"
+S = "${WORKDIR}/git"
+
+inherit meson pkgconfig update-rc.d
+
+PACKAGECONFIG ?= "libseat-builtin"
+
+PACKAGECONFIG[libseat-builtin] = "-Dlibseat-builtin=enabled,-Dlibseat-builtin=disabled"
+
+do_install:append() {
+        if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
+                install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/seatd
+        fi
+}
+
+INITSCRIPT_NAME = "seatd"
+INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
+INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}"
+