diff mbox series

[1/2] seatd: Create seat user and package systemd service

Message ID 20241127005121.683644-1-raj.khem@gmail.com
State New
Headers show
Series [1/2] seatd: Create seat user and package systemd service | expand

Commit Message

Khem Raj Nov. 27, 2024, 12:51 a.m. UTC
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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-core/seatd/seatd_0.9.1.bb | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Yoann Congal Nov. 27, 2024, 7:45 a.m. UTC | #1
Hello,

Le mer. 27 nov. 2024 à 01:51, Khem Raj via lists.openembedded.org <raj.khem=
gmail.com@lists.openembedded.org> a écrit :

> 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
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-core/seatd/seatd_0.9.1.bb | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-core/seatd/seatd_0.9.1.bb
> b/meta/recipes-core/seatd/seatd_0.9.1.bb
> index 8da57acc567..8ee43a3dc8f 100644
> --- a/meta/recipes-core/seatd/seatd_0.9.1.bb
> +++ b/meta/recipes-core/seatd/seatd_0.9.1.bb
> @@ -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"
>

This new group needs to be added to the static id list
(meta-selftest/files/static-group ?) or will break the reproducibility
tests.
The reproducibility test builds with:
  USERADDEXTENSION = "useradd-staticids"
  USERADD_ERROR_DYNAMIC = "skip"

Then, with this patch, I get this error:
  ERROR: Nothing PROVIDES 'seatd'
  seatd was skipped: Recipe seatd, package seatd: system groupname "seat"
does not have a static ID defined. USERADD_GID_TABLES file(s) not found in
BBPATH: files/group



> +
>  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"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#207890):
> https://lists.openembedded.org/g/openembedded-core/message/207890
> Mute This Topic: https://lists.openembedded.org/mt/109799901/4316185
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> yoann.congal@smile.fr]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
Richard Purdie Nov. 27, 2024, 10:24 a.m. UTC | #2
On Wed, 2024-11-27 at 08:45 +0100, Yoann Congal via
lists.openembedded.org wrote:
> Hello,
> 
> Le mer. 27 nov. 2024 à 01:51, Khem Raj via lists.openembedded.org
> <raj.khem=gmail.com@lists.openembedded.org> a écrit :
> > 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
> > 
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  meta/recipes-core/seatd/seatd_0.9.1.bb | 11 +++++++++--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> > 
> > diff --git a/meta/recipes-core/seatd/seatd_0.9.1.bb b/meta/recipes-
> > core/seatd/seatd_0.9.1.bb
> > index 8da57acc567..8ee43a3dc8f 100644
> > --- a/meta/recipes-core/seatd/seatd_0.9.1.bb
> > +++ b/meta/recipes-core/seatd/seatd_0.9.1.bb
> > @@ -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"
> > 
> 
> 
> This new group needs to be added to the static id list (meta-
> selftest/files/static-group ?) or will break the reproducibility
> tests.
> The reproducibility test builds with:
>   USERADDEXTENSION = "useradd-staticids"
>   USERADD_ERROR_DYNAMIC = "skip"
> 
> Then, with this patch, I get this error:
>   ERROR: Nothing PROVIDES 'seatd'
>   seatd was skipped: Recipe seatd, package seatd: system groupname
> "seat" does not have a static ID defined. USERADD_GID_TABLES file(s)
> not found in BBPATH: files/group

Thanks, I was in the process of reviewing things so I've added a change
to try and cover this.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/recipes-core/seatd/seatd_0.9.1.bb b/meta/recipes-core/seatd/seatd_0.9.1.bb
index 8da57acc567..8ee43a3dc8f 100644
--- a/meta/recipes-core/seatd/seatd_0.9.1.bb
+++ b/meta/recipes-core/seatd/seatd_0.9.1.bb
@@ -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"