weston-init: add extra config for weston global socket
cover weston-init: add extra config for weston global socket
From: Randolph Sapp <[email protected]>
Cleaning up some parts of weston-init, adding guards to systemd init scripts, making sure users are in the correct groups for interacting with graphics devices and finally attempting to help direct users to the global Wayland socket when they are allowed to interact with it.
The only functional change here is the addition of a profile script that checks if the user is in the correct group to interact with the global systemd socket at /run/wayland-0; if they are, then we set WAYLAND_DISPLAY to point to that socket directly.
Randolph Sapp (6):
weston-init: make sure the render group exists
weston-init: add weston user to the render group
weston-init: add the weston user to the wayland group
weston-init: fix the mixed indentation
weston-init: guard against systemd configs
weston-init: add profile to point users to global socket
meta/recipes-graphics/wayland/weston-init.bb | 88 ++++++++++--------- .../wayland/weston-init/weston-socket.sh | 20 +++++ 2 files changed, 68 insertions(+), 40 deletions(-) create mode 100755 meta/recipes-graphics/wayland/weston-init/weston-socket.sh
Signature · 1 line
2.41.0
PATCH 1/6 weston-init: make sure the render group exists
From: Randolph Sapp <[email protected]>
Add the render group explicitly here to make sure it exists for the useradd command.
--- meta/recipes-graphics/wayland/weston-init.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/wayland/weston-init.bb +1 -1
@@ -94,5 +94,5 @@ CONFFILES:${PN} += "${sysconfdir}/xdg/weston/weston.ini ${sysconfdir}/default/we SYSTEMD_SERVICE:${PN} = "weston.service weston.socket" USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input weston" -GROUPADD_PARAM:${PN} = "-r wayland" +GROUPADD_PARAM:${PN} = "-r wayland; -r render"
Signature · 1 line
2.41.0
PATCH 2/6 weston-init: add weston user to the render group
In reply to [email protected]From: Randolph Sapp <[email protected]>
The weston user must be in the render group in order to access render device nodes for standard user-space graphics.
--- meta/recipes-graphics/wayland/weston-init.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/wayland/weston-init.bb +1 -1
@@ -93,6 +93,6 @@ 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 weston" +USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render weston" GROUPADD_PARAM:${PN} = "-r wayland; -r render"
Signature · 1 line
2.41.0
PATCH 3/6 weston-init: add the weston user to the wayland group
In reply to [email protected]From: Randolph Sapp <[email protected]>
Add the weston user to the wayland group so all users accessing the global weston socket in /run all share a group.
--- meta/recipes-graphics/wayland/weston-init.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/wayland/weston-init.bb +1 -1
@@ -93,6 +93,6 @@ 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 weston" +USERADD_PARAM:${PN} = "--home /home/weston --shell /bin/sh --user-group -G video,input,render,wayland weston" GROUPADD_PARAM:${PN} = "-r wayland; -r render"
Signature · 1 line
2.41.0
PATCH 4/6 weston-init: fix the mixed indentation
In reply to [email protected]From: Randolph Sapp <[email protected]>
I know my text editor is going to get angry at me if this continues.
--- meta/recipes-graphics/wayland/weston-init.bb | 76 ++++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-)
meta/recipes-graphics/wayland/weston-init.bb +38 -38
@@ -26,44 +26,44 @@ DEFAULTBACKEND ??= "" DEFAULTBACKEND:qemuall ?= "drm" do_install() { - if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then - install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston - sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston - fi - install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini - install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston - - # Install Weston systemd service and accompanying udev rule - install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service - install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket - if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then - install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin - fi - sed -i -e s:/etc:${sysconfdir}:g \ - -e s:/usr/bin:${bindir}:g \ - -e s:/var:${localstatedir}:g \ - ${D}${systemd_system_unitdir}/weston.service - # Install weston-start script - install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start - sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start - sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start - if [ -n "${DEFAULTBACKEND}" ]; then - sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then - sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then - sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then - sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini - fi - - install -dm 755 -o weston -g weston ${D}/home/weston + if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then + install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston + sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston + fi + install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini + install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston + + # Install Weston systemd service and accompanying udev rule + install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service + install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then + install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin + fi + sed -i -e s:/etc:${sysconfdir}:g \ + -e s:/usr/bin:${bindir}:g \ + -e s:/var:${localstatedir}:g \ + ${D}${systemd_system_unitdir}/weston.service + # Install weston-start script + install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start + sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start + sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start + if [ -n "${DEFAULTBACKEND}" ]; then + sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then + sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then + sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then + sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini + fi + + install -dm 755 -o weston -g weston ${D}/home/weston } INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}"
Signature · 1 line
2.41.0
RE: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
Quoted 6 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Randolph Sapp via lists.openembedded.org
Sent: den 10 juni 2023 03:14
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Randolph Sapp <[email protected]>
Subject: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
AFAIK, the official standard for OE-Core is to use tabs for indentation of shell code, and four spaces for Python code and bitbake variables. (But beware, other layers may use different standards, e.g., meta-openembedded uses four spaces for everything.)
Quoted 4 lines
From: Randolph Sapp <[email protected]>
I know my text editor is going to get angry at me if this continues.
Get a better editor. ;) At least for Emacs there is a bitbake-mode that supports the different ways of indenting shell and Python code in the same recipe.
Quoted 95 lines
Signed-off-by Randolph Sapp <[email protected]>--- meta/recipes-graphics/wayland/weston-init.bb | 76 ++++++++++---------- 1 file changed, 38 insertions(+), 38 deletions(-)meta/recipes- renamed from meta/recipes-graphics/wayland/weston-init.bb +0
-0graphics/wayland/weston-init.bb
index4fa302c833..01abd4ce78100644meta/recipes-graphics/wayland/weston-init.bb +38
-39@@ -26,44 +26,44 @@ DEFAULTBACKEND ??= "" DEFAULTBACKEND:qemuall ?= "drm" do_install() { - if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then - install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston - sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston - fi - install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini - install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston - - # Install Weston systemd service and accompanying udev rule - install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service - install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket - if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then - install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin - fi - sed -i -e s:/etc:${sysconfdir}:g \ - -e s:/usr/bin:${bindir}:g \ - -e s:/var:${localstatedir}:g \ - ${D}${systemd_system_unitdir}/weston.service - # Install weston-start script - install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start - sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start - sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start - if [ -n "${DEFAULTBACKEND}" ]; then - sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then - sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then - sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini - fi - - if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then - sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini - fi - - install -dm 755 -o weston -g weston ${D}/home/weston + if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then + install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston + sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston + fi + install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini + install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston + + # Install Weston systemd service and accompanying udev rule + install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service + install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then + install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin + fi + sed -i -e s:/etc:${sysconfdir}:g \ + -e s:/usr/bin:${bindir}:g \ + -e s:/var:${localstatedir}:g \ + ${D}${systemd_system_unitdir}/weston.service + # Install weston-start script + install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start + sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start + sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start + if [ -n "${DEFAULTBACKEND}" ]; then + sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'xwayland', 'yes', 'no', d)}" = "yes" ]; then + sed -i -e "/^\[core\]/a xwayland=true" ${D}${sysconfdir}/xdg/weston/weston.ini + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'no-idle-timeout', 'yes', 'no', d)}" = "yes" ]; then + sed -i -e "/^\[core\]/a idle-time=0" ${D}${sysconfdir}/xdg/weston/weston.ini + fi + + if [ "${@bb.utils.contains('PACKAGECONFIG', 'use-pixman', 'yes', 'no', d)}" = "yes" ]; then + sed -i -e "/^\[core\]/a use-pixman=true" ${D}${sysconfdir}/xdg/weston/weston.ini + fi + + install -dm 755 -o weston -g weston ${D}/home/weston } INHIBIT_UPDATERCD_BBCLASS = "${@oe.utils.conditional('VIRTUAL-RUNTIME_init_manager', 'systemd', '1', '', d)}" --
Quoted 1 line
2.41.0
//Peter
Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
Quoted 5 lines · Peter Kjellerstedt
Quoted 1 line
I know my text editor is going to get angry at me if this continues.
Get a better editor. ;) At least for Emacs there is a bitbake-mode that supports the different ways of indenting shell and Python code in the same recipe.
Or we can stop caring about indentation, as long as it's consistent with what is already there, and doesn't get in the way of reviewing patches. That's my preferred option, and has been for the past 25 years.
Alex
RE: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
Quoted 17 lines
-----Original Message-----
From: Alexander Kanavin <[email protected]>
Sent: den 12 juni 2023 11:19
To: Peter Kjellerstedt <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; openembedded- [email protected]
Subject: Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentationQuoted 5 lines · Peter Kjellerstedt
Quoted 1 line
I know my text editor is going to get angry at me if this continues.
Get a better editor. ;) At least for Emacs there is a bitbake-mode that supports the different ways of indenting shell and Python code in the same recipe.
Quoted 6 lines
Or we can stop caring about indentation, as long as it's consistent with what is already there, and doesn't get in the way of reviewing patches. That's my preferred option, and has been for the past 25 years.
Alex
Well that is of course an option, but then it may get messy if different people have different preferences and start changing the indentation back and forth...
//Peter
Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
Quoted 3 lines · Peter Kjellerstedt
Well that is of course an option, but then it may get messy if different people have different preferences and start changing the indentation back and forth...
I suppose changing indentation needs to be justified by for example achieving consistency in the same code block (as it does here, which is fine), and it never should be mixed in with functional changes. What I don't want is lots of empty code churn that doesn't actually make things more readable than they already were, and is more or less an exercise in pedantic neat freakery.
Alex
Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
Quoted 6 lines · Alexander Kanavin
Quoted 3 lines · Peter Kjellerstedt
Well that is of course an option, but then it may get messy if different people have different preferences and start changing the indentation back and forth...
Quoted 8 lines
I suppose changing indentation needs to be justified by for example achieving consistency in the same code block (as it does here, which is fine), and it never should be mixed in with functional changes. What I don't want is lots of empty code churn that doesn't actually make things more readable than they already were, and is more or less an exercise in pedantic neat freakery.
Alex
I frankly don't like the concept of mixed indentation in the same file, let alone the same code block. The only thing really driving me to change it here was the lack of git attributes to define the project standard, nvim is attempting to enforce the 4 space standard from python over the entirety of bitbake recipes (which I think is fairly sane), and the variance of standard in this code block.
I have no preference. So long as there is a standard, I will bow to it.
Randolph
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
Quoted 14 lines · Randolph Sapp via lists.openembedded.org
Quoted 13 lines · Alexander Kanavin
Quoted 3 lines · Peter Kjellerstedt
Well that is of course an option, but then it may get messy if different people have different preferences and start changing the indentation back and forth...
I suppose changing indentation needs to be justified by for example achieving consistency in the same code block (as it does here, which is fine), and it never should be mixed in with functional changes. What I don't want is lots of empty code churn that doesn't actually make things more readable than they already were, and is more or less an exercise in pedantic neat freakery.
Quoted 8 lines
Quoted 1 line
Alex
I frankly don't like the concept of mixed indentation in the same file, let alone the same code block. The only thing really driving me to change it here was the lack of git attributes to define the project standard, nvim is attempting to enforce the 4 space standard from python over the entirety of bitbake recipes (which I think is fairly sane), and the variance of standard in this code block.
I have no preference. So long as there is a standard, I will bow to it.
Randolph
I noticed master didn't pick up any patches past this one. I take it you want me to reformat this to the current tab shell block standard?
Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
Quoted 2 lines · Randolph Sapp
I noticed master didn't pick up any patches past this one. I take it you want me to reformat this to the current tab shell block standard?
The remaining patches are still in the staging branch:
https://git.yoctoproject.org/poky-contrib/log/?h=abelloni/master-next
If they're dropped from it, there'll be a separate email explaining what to do.
Alex
Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
In reply to Randolph SappQuoted 25 lines · Randolph Sapp
Quoted 24 lines · Randolph Sapp via lists.openembedded.org
Quoted 7 lines · Alexander Kanavin
Quoted 4 lines · Peter Kjellerstedt
Well that is of course an option, but then it may get messy if different people have different preferences and start changing the indentation back
and forth...Quoted 8 lines
I suppose changing indentation needs to be justified by for example achieving consistency in the same code block (as it does here, which is fine), and it never should be mixed in with functional changes. What I don't want is lots of empty code churn that doesn't actually make things more readable than they already were, and is more or less an exercise in pedantic neat freakery.
Alex
I frankly don't like the concept of mixed indentation in the same file, let alone the same code block. The only thing really driving me to change it here was the lack of git attributes to define the project standard, nvim is attempting to enforce the 4 space standard from python over the entirety of bitbake recipes (which I think is fairly sane), and the variance of standard in this code block.
Quoted 7 lines
Quoted 4 lines
I have no preference. So long as there is a standard, I will bow to it.
Randolph
I noticed master didn't pick up any patches past this one. I take it you want me to reformat this to the current tab shell block standard?
Yes please. I stopped there since at least at a quick glance it looked mostly tab indented and this changed it to space which breaks the code standard for oe-core. Whether we want to change that isn't something I have the time/energy to get into right now. If I take it, I'm opening the gates to many more such changes. There are views on both sides and people get upset about various aspects of it, me included.
Cheers,
Richard
Re: [EXTERNAL] Re: [OE-core][PATCH 4/6] weston-init: fix the mixed indentation
Quoted 41 lines · Richard Purdie
Quoted 25 lines · Randolph Sapp
Quoted 24 lines · Randolph Sapp via lists.openembedded.org
Quoted 7 lines · Alexander Kanavin
Quoted 4 lines · Peter Kjellerstedt
Well that is of course an option, but then it may get messy if different people have different preferences and start changing the indentation back
and forth...Quoted 8 lines
I suppose changing indentation needs to be justified by for example achieving consistency in the same code block (as it does here, which is fine), and it never should be mixed in with functional changes. What I don't want is lots of empty code churn that doesn't actually make things more readable than they already were, and is more or less an exercise in pedantic neat freakery.
Alex
I frankly don't like the concept of mixed indentation in the same file, let alone the same code block. The only thing really driving me to change it here was the lack of git attributes to define the project standard, nvim is attempting to enforce the 4 space standard from python over the entirety of bitbake recipes (which I think is fairly sane), and the variance of standard in this code block.
Quoted 7 lines
Quoted 4 lines
I have no preference. So long as there is a standard, I will bow to it.
Randolph
I noticed master didn't pick up any patches past this one. I take it you want me to reformat this to the current tab shell block standard?
Yes please. I stopped there since at least at a quick glance it looked mostly tab indented and this changed it to space which breaks the code standard for oe-core. Whether we want to change that isn't something I have the time/energy to get into right now. If I take it, I'm opening the gates to many more such changes. There are views on both sides and people get upset about various aspects of it, me included.
Quoted 4 lines
Cheers,
Richard
Alright. I'll fix this up and resubmit.
PATCH 5/6 weston-init: guard against systemd configs
In reply to [email protected]From: Randolph Sapp <[email protected]>
Just as sysvinit scripts shouldn't be present in a distro using systemd, systemd scripts shouldn't be present in a system not using systemd.
--- meta/recipes-graphics/wayland/weston-init.bb | 29 ++++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-)
meta/recipes-graphics/wayland/weston-init.bb +17 -12
@@ -26,27 +26,32 @@ DEFAULTBACKEND ??= "" DEFAULTBACKEND:qemuall ?= "drm" do_install() { + # Install weston-start script if [ "${VIRTUAL-RUNTIME_init_manager}" != "systemd" ]; then + install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start + sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start + sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston fi - install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini - install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston # Install Weston systemd service and accompanying udev rule - install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service - install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket + if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then + install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service + install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket + sed -i -e s:/etc:${sysconfdir}:g \ + -e s:/usr/bin:${bindir}:g \ + -e s:/var:${localstatedir}:g \ + ${D}${systemd_system_unitdir}/weston.service + fi + if [ "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" ]; then install -D -p -m0644 ${WORKDIR}/weston-autologin ${D}${sysconfdir}/pam.d/weston-autologin fi - sed -i -e s:/etc:${sysconfdir}:g \ - -e s:/usr/bin:${bindir}:g \ - -e s:/var:${localstatedir}:g \ - ${D}${systemd_system_unitdir}/weston.service - # Install weston-start script - install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start - sed -i 's,@DATADIR@,${datadir},g' ${D}${bindir}/weston-start - sed -i 's,@LOCALSTATEDIR@,${localstatedir},g' ${D}${bindir}/weston-start + + install -D -p -m0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}/xdg/weston/weston.ini + install -Dm644 ${WORKDIR}/weston.env ${D}${sysconfdir}/default/weston + if [ -n "${DEFAULTBACKEND}" ]; then sed -i -e "/^\[core\]/a backend=${DEFAULTBACKEND}-backend.so" ${D}${sysconfdir}/xdg/weston/weston.ini fi
Signature · 1 line
2.41.0
PATCH 6/6 weston-init: add profile to point users to global socket
In reply to [email protected]From: Randolph Sapp <[email protected]>
Add profile script to point users capable of interacting with the global socket to it by default.
--- meta/recipes-graphics/wayland/weston-init.bb | 3 +++ .../wayland/weston-init/weston-socket.sh | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100755 meta/recipes-graphics/wayland/weston-init/weston-socket.sh
meta/recipes-graphics/wayland/weston-init.bb +3 -0
@@ -9,6 +9,7 @@ SRC_URI = "file://init \ file://weston.ini \ file://weston.service \ file://weston.socket \ + file://weston-socket.sh \ file://weston-autologin \ file://weston-start"
@@ -39,6 +40,7 @@ do_install() { if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then install -D -p -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${systemd_system_unitdir}/weston.socket + install -D -p -m0644 ${WORKDIR}/weston-socket.sh ${D}${sysconfdir}/profile.d/weston-socket.sh sed -i -e s:/etc:${sysconfdir}:g \ -e s:/usr/bin:${bindir}:g \ -e s:/var:${localstatedir}:g \
@@ -88,6 +90,7 @@ INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ." FILES:${PN} += "\ ${sysconfdir}/xdg/weston/weston.ini \ + ${sysconfdir}/profile.d/weston-socket.sh \ ${systemd_system_unitdir}/weston.service \ ${systemd_system_unitdir}/weston.socket \ ${sysconfdir}/default/weston \
meta/recipes-graphics/wayland/weston-init/weston-socket.sh new file +20 -0
@@ -0,0 +1,20 @@ +#!/bin/sh + +# set weston variables for use with global weston socket +global_socket="/run/wayland-0" +if [ -e "$global_socket" ]; then + weston_group=$(stat -c "%G" "$global_socket") + if [ "$(id -u)" = "0" ]; then + export WAYLAND_DISPLAY="$global_socket" + else + case "$(groups "$USER")" in + *"$weston_group"*) + export WAYLAND_DISPLAY="$global_socket" + ;; + *) + ;; + esac + fi + unset weston_group +fi +unset global_socket
Signature · 1 line
2.41.0