* [dunfell][PATCH] weston-init: Override the systemd service by a notify-based one
@ 2021-10-06 10:00 pavel
2021-10-06 10:05 ` [OE-core] " Konrad Weihmann
0 siblings, 1 reply; 2+ messages in thread
From: pavel @ 2021-10-06 10:00 UTC (permalink / raw)
To: openembedded-core; +Cc: steve, Pavel Zhukov, pavel, Andrei Gherzan
From: Pavel Zhukov <pavel.zhukov@huawei.com>
Using systemd notify, a service dependency would be more robust. This
allows, for example, another service to depend on weston-init without
having to hack a sleep (or similar). This change required more robust
handling of weston modules argument due to custom argument parser
impmentation in weston (only last --modules argument is accepted).
Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
.../wayland/weston-init/weston-start | 12 ++++++++++++
.../wayland/weston-init/weston@.service | 6 ++++++
.../wayland/weston/systemd-notify.weston-start | 9 +++++++++
.../wayland/weston/xwayland.weston-start | 3 +--
meta/recipes-graphics/wayland/weston_8.0.0.bb | 6 ++++++
5 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 meta/recipes-graphics/wayland/weston/systemd-notify.weston-start
diff --git a/meta/recipes-graphics/wayland/weston-init/weston-start b/meta/recipes-graphics/wayland/weston-init/weston-start
index ccc7093425..97471df80d 100755
--- a/meta/recipes-graphics/wayland/weston-init/weston-start
+++ b/meta/recipes-graphics/wayland/weston-init/weston-start
@@ -23,6 +23,15 @@ add_openvt_argument() {
openvt_args="$openvt_args $1"
}
+## Add module to --modules argument
+add_weston_module() {
+ if [ -z "${weston_modules}" ]; then
+ weston_modules="--modules "
+ fi;
+ weston_modules="${weston_modules}${1},"
+}
+
+
if [ -n "$WAYLAND_DISPLAY" ]; then
echo "ERROR: A Wayland compositor is already running, nested Weston instance is not supported yet."
exit 1
@@ -65,6 +74,9 @@ if [ -d "$modules_dir" ]; then
# process module
. $m
done
+ if [ -n "${weston_modules}" ]; then
+ add_weston_argument "${weston_modules} "
+ fi;
fi
if test -z "$XDG_RUNTIME_DIR"; then
diff --git a/meta/recipes-graphics/wayland/weston-init/weston@.service b/meta/recipes-graphics/wayland/weston-init/weston@.service
index 39e193014a..70c706d75c 100644
--- a/meta/recipes-graphics/wayland/weston-init/weston@.service
+++ b/meta/recipes-graphics/wayland/weston-init/weston@.service
@@ -1,3 +1,7 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
[Unit]
Description=Weston Wayland Compositor
RequiresMountsFor=/run
@@ -5,6 +9,8 @@ Conflicts=plymouth-quit.service
After=systemd-user-sessions.service plymouth-quit-wait.service
[Service]
+Type=notify
+NotifyAccess=all
User=%i
PAMName=login
EnvironmentFile=-/etc/default/weston
diff --git a/meta/recipes-graphics/wayland/weston/systemd-notify.weston-start b/meta/recipes-graphics/wayland/weston/systemd-notify.weston-start
new file mode 100644
index 0000000000..fdb48cb609
--- /dev/null
+++ b/meta/recipes-graphics/wayland/weston/systemd-notify.weston-start
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# SPDX-FileCopyrightText: Huawei Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+
+if [[ -x "/usr/lib/weston/systemd-notify.so" ]]; then
+ add_weston_module "systemd-notify.so"
+fi
diff --git a/meta/recipes-graphics/wayland/weston/xwayland.weston-start b/meta/recipes-graphics/wayland/weston/xwayland.weston-start
index b483c97cf1..22984f50a4 100644
--- a/meta/recipes-graphics/wayland/weston/xwayland.weston-start
+++ b/meta/recipes-graphics/wayland/weston/xwayland.weston-start
@@ -2,6 +2,5 @@
if type Xwayland >/dev/null 2>/dev/null; then
mkdir -p /tmp/.X11-unix
-
- add_weston_argument "--modules=xwayland.so"
+ add_weston_module "xwayland.so"
fi
diff --git a/meta/recipes-graphics/wayland/weston_8.0.0.bb b/meta/recipes-graphics/wayland/weston_8.0.0.bb
index 0b383f25f3..2b120d7404 100644
--- a/meta/recipes-graphics/wayland/weston_8.0.0.bb
+++ b/meta/recipes-graphics/wayland/weston_8.0.0.bb
@@ -5,9 +5,11 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \
file://libweston/compositor.c;endline=27;md5=6c53bbbd99273f4f7c4affa855c33c0a"
+
SRC_URI = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
file://weston.png \
file://weston.desktop \
+ file://systemd-notify.weston-start \
file://xwayland.weston-start \
file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \
"
@@ -101,6 +103,10 @@ do_install_append() {
install -Dm 644 ${WORKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland
fi
+ if [ "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'yes', 'no', d)}" = "yes" ]; then
+ install -Dm 644 ${WORKDIR}/systemd-notify.weston-start ${D}${datadir}/weston-start/systemd-notify
+ fi
+
if [ "${@bb.utils.contains('PACKAGECONFIG', 'launch', 'yes', 'no', d)}" = "yes" ]; then
chmod u+s ${D}${bindir}/weston-launch
fi
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [OE-core] [dunfell][PATCH] weston-init: Override the systemd service by a notify-based one
2021-10-06 10:00 [dunfell][PATCH] weston-init: Override the systemd service by a notify-based one pavel
@ 2021-10-06 10:05 ` Konrad Weihmann
0 siblings, 0 replies; 2+ messages in thread
From: Konrad Weihmann @ 2021-10-06 10:05 UTC (permalink / raw)
To: Pavel Zhukov, openembedded-core; +Cc: steve, Pavel Zhukov, Andrei Gherzan
Without looking to much into the technical details of this patch,
- it should master first (and then be backported to dunfell)
- the patches to need an Upstream-Status field
- changes should be brought to upstream first (and if rejected then a
proper explanation has to be provided in the patch metadata)
On 06.10.21 12:00, Pavel Zhukov wrote:
> From: Pavel Zhukov <pavel.zhukov@huawei.com>
>
> Using systemd notify, a service dependency would be more robust. This
> allows, for example, another service to depend on weston-init without
> having to hack a sleep (or similar). This change required more robust
> handling of weston modules argument due to custom argument parser
> impmentation in weston (only last --modules argument is accepted).
>
> Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com>
> Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
> ---
> .../wayland/weston-init/weston-start | 12 ++++++++++++
> .../wayland/weston-init/weston@.service | 6 ++++++
> .../wayland/weston/systemd-notify.weston-start | 9 +++++++++
> .../wayland/weston/xwayland.weston-start | 3 +--
> meta/recipes-graphics/wayland/weston_8.0.0.bb | 6 ++++++
> 5 files changed, 34 insertions(+), 2 deletions(-)
> create mode 100644 meta/recipes-graphics/wayland/weston/systemd-notify.weston-start
>
> diff --git a/meta/recipes-graphics/wayland/weston-init/weston-start b/meta/recipes-graphics/wayland/weston-init/weston-start
> index ccc7093425..97471df80d 100755
> --- a/meta/recipes-graphics/wayland/weston-init/weston-start
> +++ b/meta/recipes-graphics/wayland/weston-init/weston-start
> @@ -23,6 +23,15 @@ add_openvt_argument() {
> openvt_args="$openvt_args $1"
> }
>
> +## Add module to --modules argument
> +add_weston_module() {
> + if [ -z "${weston_modules}" ]; then
> + weston_modules="--modules "
> + fi;
> + weston_modules="${weston_modules}${1},"
> +}
> +
> +
> if [ -n "$WAYLAND_DISPLAY" ]; then
> echo "ERROR: A Wayland compositor is already running, nested Weston instance is not supported yet."
> exit 1
> @@ -65,6 +74,9 @@ if [ -d "$modules_dir" ]; then
> # process module
> . $m
> done
> + if [ -n "${weston_modules}" ]; then
> + add_weston_argument "${weston_modules} "
> + fi;
> fi
>
> if test -z "$XDG_RUNTIME_DIR"; then
> diff --git a/meta/recipes-graphics/wayland/weston-init/weston@.service b/meta/recipes-graphics/wayland/weston-init/weston@.service
> index 39e193014a..70c706d75c 100644
> --- a/meta/recipes-graphics/wayland/weston-init/weston@.service
> +++ b/meta/recipes-graphics/wayland/weston-init/weston@.service
> @@ -1,3 +1,7 @@
> +# SPDX-FileCopyrightText: Huawei Inc.
> +#
> +# SPDX-License-Identifier: Apache-2.0
> +
> [Unit]
> Description=Weston Wayland Compositor
> RequiresMountsFor=/run
> @@ -5,6 +9,8 @@ Conflicts=plymouth-quit.service
> After=systemd-user-sessions.service plymouth-quit-wait.service
>
> [Service]
> +Type=notify
> +NotifyAccess=all
this can be also achieved with a drop-in file, which is less invasive
then the proposed change
> User=%i
> PAMName=login
> EnvironmentFile=-/etc/default/weston
> diff --git a/meta/recipes-graphics/wayland/weston/systemd-notify.weston-start b/meta/recipes-graphics/wayland/weston/systemd-notify.weston-start
> new file mode 100644
> index 0000000000..fdb48cb609
> --- /dev/null
> +++ b/meta/recipes-graphics/wayland/weston/systemd-notify.weston-start
> @@ -0,0 +1,9 @@
> +#!/bin/sh
> +
> +# SPDX-FileCopyrightText: Huawei Inc.
> +# SPDX-License-Identifier: Apache-2.0
> +
> +
> +if [[ -x "/usr/lib/weston/systemd-notify.so" ]]; then
> + add_weston_module "systemd-notify.so"
> +fi
> diff --git a/meta/recipes-graphics/wayland/weston/xwayland.weston-start b/meta/recipes-graphics/wayland/weston/xwayland.weston-start
> index b483c97cf1..22984f50a4 100644
> --- a/meta/recipes-graphics/wayland/weston/xwayland.weston-start
> +++ b/meta/recipes-graphics/wayland/weston/xwayland.weston-start
> @@ -2,6 +2,5 @@
>
> if type Xwayland >/dev/null 2>/dev/null; then
> mkdir -p /tmp/.X11-unix
> -
> - add_weston_argument "--modules=xwayland.so"
> + add_weston_module "xwayland.so"
> fi
> diff --git a/meta/recipes-graphics/wayland/weston_8.0.0.bb b/meta/recipes-graphics/wayland/weston_8.0.0.bb
> index 0b383f25f3..2b120d7404 100644
> --- a/meta/recipes-graphics/wayland/weston_8.0.0.bb
> +++ b/meta/recipes-graphics/wayland/weston_8.0.0.bb
> @@ -5,9 +5,11 @@ LICENSE = "MIT"
> LIC_FILES_CHKSUM = "file://COPYING;md5=d79ee9e66bb0f95d3386a7acae780b70 \
> file://libweston/compositor.c;endline=27;md5=6c53bbbd99273f4f7c4affa855c33c0a"
>
> +
> SRC_URI = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \
> file://weston.png \
> file://weston.desktop \
> + file://systemd-notify.weston-start \
> file://xwayland.weston-start \
> file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \
> "
> @@ -101,6 +103,10 @@ do_install_append() {
> install -Dm 644 ${WORKDIR}/xwayland.weston-start ${D}${datadir}/weston-start/xwayland
> fi
>
> + if [ "${@bb.utils.contains('PACKAGECONFIG', 'systemd', 'yes', 'no', d)}" = "yes" ]; then
> + install -Dm 644 ${WORKDIR}/systemd-notify.weston-start ${D}${datadir}/weston-start/systemd-notify
> + fi
> +
> if [ "${@bb.utils.contains('PACKAGECONFIG', 'launch', 'yes', 'no', d)}" = "yes" ]; then
> chmod u+s ${D}${bindir}/weston-launch
> fi
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#156682): https://lists.openembedded.org/g/openembedded-core/message/156682
> Mute This Topic: https://lists.openembedded.org/mt/86115689/3647476
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [kweihmann@outlook.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-06 10:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 10:00 [dunfell][PATCH] weston-init: Override the systemd service by a notify-based one pavel
2021-10-06 10:05 ` [OE-core] " Konrad Weihmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.