Skip to contentSkip to conversation

seatd: Create seat user and package systemd service

PATCH New Khem Raj 1 participant 2 messages Nov 27, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/2 seatd: Create seat user and package systemd service

With latest version seatd does not work properly if user access permissions are not correctly set, therefore create 'seat' group and package the seatd.service file and enable it by default with systemd distro feature

set logind to systemd when using systemd as default init system

---
v2: Use seat group instead of video group in init file

 meta/recipes-core/seatd/seatd/init     |  2 +-
 meta/recipes-core/seatd/seatd_0.9.1.bb | 11 +++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
meta/recipes-core/seatd/seatd/init +1 -1
index 0589c765ac7..405000c16f3 100644
@@ -15,7 +15,7 @@ killproc() {
 
 case "$1" in
   start)
-        seatd -g video -n 1 > /tmp/seatd-start-notify &
+        seatd -g seat -n 1 > /tmp/seatd-start-notify &
         [ -s /tmp/seatd-start-notify ] && exit 0
         sleep 0.1
         [ -s /tmp/seatd-start-notify ] && exit 0
meta/recipes-core/seatd/seatd_0.9.1.bb +9 -2
index 8da57acc567..8ee43a3dc8f 100644
@@ -11,7 +11,7 @@ SRC_URI = "git://git.sr.ht/~kennylevinsen/seatd;protocol=https;branch=master \
 SRCREV = "566ffeb032af42865dc1210e48cec08368059bb9"
 S = "${WORKDIR}/git"
 
-inherit meson pkgconfig update-rc.d
+inherit meson pkgconfig systemd update-rc.d useradd
 
 # https://www.openwall.com/lists/musl/2020/01/20/3
 CFLAGS:append:libc-musl:powerpc64le = " -Wno-error=overflow"
@@ -22,14 +22,21 @@ PACKAGECONFIG ?= " \
 "
 
 PACKAGECONFIG[libseat-builtin] = "-Dlibseat-builtin=enabled,-Dlibseat-builtin=disabled"
-PACKAGECONFIG[systemd] = ",,systemd"
+PACKAGECONFIG[systemd] = "-Dlibseat-logind=systemd,,systemd"
 
 do_install:append() {
         if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then
                 install -Dm755 ${UNPACKDIR}/init ${D}/${sysconfdir}/init.d/seatd
+        else
+                install -Dm644 ${S}/contrib/systemd/seatd.service ${D}${systemd_unitdir}/system/seatd.service
         fi
 }
 
+USERADD_PACKAGES = "${PN}"
+GROUPADD_PARAM:${PN} = "-r seat"
+
 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)}"
+
+SYSTEMD_SERVICE:${PN} = "seatd.service"
author
#1 lore raw

PATCH v2 2/2 weston-init: Make weston user member of seat group

This enables weston launch to access the seatd socket /run/seatd.sock to communicate properly to acquire seat

---
v2: Create seat group as well

 meta/recipes-graphics/wayland/weston-init.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes-graphics/wayland/weston-init.bb +2 -3
index 3de697ec34e..5723655a9bb 100644
@@ -102,6 +102,5 @@ FILES:${PN} += "\
 CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/weston"
 
 SYSTEMD_SERVICE:${PN} = "weston.service weston.socket"
-USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render,wayland weston"
-GROUPADD_PARAM:${PN} = "-r wayland; -r render"
-
+USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render,seat,wayland weston"
+GROUPADD_PARAM:${PN} = "-r wayland; -r render; -r seat"