diff mbox series

recipes-graphics: wayland: Add systemd service to launch weston on boot

Message ID 20230522171155.15200-1-c-shilwant@ti.com
State Rejected
Delegated to: Ryan Eatmon
Headers show
Series recipes-graphics: wayland: Add systemd service to launch weston on boot | expand

Commit Message

Chirag Shilwant May 22, 2023, 5:11 p.m. UTC
- openembedded-core:kirkstone added a condition to package weston init.d script only when VIRTUAL-RUNTIME_init_manager isn't systemd which wasn't in dunfell. Hence, manually install and ship the weston init.d script.

- Add weston-init.service file which is a systemd service which will launch the weston init.d script. Make this service file run on boot by adding it to SYSTEMD_SERVICE.

- Reassign INITSCRIPT_NAME and INITSCRIPT_PARAMS values to nothing as weston-init.service will now be the service file.

Signed-off-by: Chirag Shilwant <c-shilwant@ti.com>
---
 .../wayland/weston-init.bbappend              | 20 ++++++++++++++-----
 .../wayland/weston-init/weston-init.service   | 10 ++++++++++
 2 files changed, 25 insertions(+), 5 deletions(-)
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/weston-init.service

Comments

Randolph Sapp May 22, 2023, 6:36 p.m. UTC | #1
On 5/22/23 12:34, Denys Dmytriyenko wrote:
> On Mon, May 22, 2023 at 10:41:55PM +0530, Chirag Shilwant wrote:
>> - openembedded-core:kirkstone added a condition to package weston init.d
>> script only when VIRTUAL-RUNTIME_init_manager isn't systemd which wasn't in
>> dunfell. Hence, manually install and ship the weston init.d script.
>>
>> - Add weston-init.service file which is a systemd service which will launch
>> the weston init.d script. Make this service file run on boot by adding it to
>> SYSTEMD_SERVICE.
>>
>> - Reassign INITSCRIPT_NAME and INITSCRIPT_PARAMS values to nothing as
>> weston-init.service will now be the service file.
> 
> 1. Why do you need to do this dance? Doesn't systemd-compat-units do that for
> you already?
> 
> 2. The plan is to convert to rootless execution of weston and hence most if
> not all of this code will be replaced anyway.
> 
> 
>> Signed-off-by: Chirag Shilwant <c-shilwant@ti.com>
>> ---
>>   .../wayland/weston-init.bbappend              | 20 ++++++++++++++-----
>>   .../wayland/weston-init/weston-init.service   | 10 ++++++++++
>>   2 files changed, 25 insertions(+), 5 deletions(-)
>>   create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/weston-init.service
>>
>> diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend b/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
>> index 28e7ae39..c294fba4 100644
>> --- a/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
>> +++ b/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
>> @@ -1,23 +1,33 @@
>>   FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
>>   
>> -PR:append = ".arago12"
>> +PR:append = ".arago13"
>>   
>>   SRC_URI:append = " \
>>       file://runWeston \
>>       file://wayland_env.sh \
>>       file://weston.ini \
>> +    file://weston-init.service \
>>   "
>>   
>>   do_install:append() {
>>       install -d ${D}${bindir}
>>       install -m 755 ${WORKDIR}/runWeston ${D}${bindir}
>>       rm -rf ${D}${systemd_system_unitdir}
>> -
>> +
>>       install -d ${D}${sysconfdir}/profile.d
>>       install -m 0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}
>>       install -m 0644 ${WORKDIR}/wayland_env.sh ${D}${sysconfdir}/profile.d/
>> +    install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
>> +    sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston
>> +
>> +    install -d ${D}${sysconfdir}/systemd/system
>> +    install -D -p -m0644 ${WORKDIR}/weston-init.service ${D}${sysconfdir}/systemd/system/weston.service
>> +    install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${sysconfdir}/systemd/system
>>   }
>>   
>> -FILES:${PN}:remove = "${systemd_system_unitdir}/weston.service ${systemd_system_unitdir}/weston.socket"
>> -FILES:${PN} += "${sysconfdir}/profile.d/* ${sysconfdir}/weston.ini"
>> -SYSTEMD_SERVICE:${PN}:remove = "weston.service weston.socket"
>> +FILES:${PN} += "${sysconfdir}/profile.d/* ${sysconfdir}/weston.ini ${sysconfdir}/systemd/system/weston.service ${sysconfdir}/systemd/system/weston.socket"
>> +
>> +SYSTEMD_SERVICE:${PN} = "weston.service"
>> +
>> +INITSCRIPT_NAME = ""
>> +INITSCRIPT_PARAMS = ""
>> diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-init.service b/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-init.service
>> new file mode 100644
>> index 00000000..d4c7d472
>> --- /dev/null
>> +++ b/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-init.service
>> @@ -0,0 +1,10 @@
>> +[Unit]
>> +Description=Systemd Service to Start Weston
>> +
>> +[Service]
>> +Type=forking
>> +ExecStart=/etc/init.d/weston start
>> +StandardOutput=journal
>> +
>> +[Install]
>> +WantedBy=multi-user.target
>> -- 
>> 2.34.1

Chirag, hold off on this for now. I've got a series cleaning up a lot of 
graphics patches in Weston, Qt, and the likes that also addresses this. 
It likely won't make 9.0 but it's still in the works.
diff mbox series

Patch

diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend b/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
index 28e7ae39..c294fba4 100644
--- a/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
+++ b/meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend
@@ -1,23 +1,33 @@ 
 FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
-PR:append = ".arago12"
+PR:append = ".arago13"
 
 SRC_URI:append = " \
     file://runWeston \
     file://wayland_env.sh \
     file://weston.ini \
+    file://weston-init.service \
 "
 
 do_install:append() {
     install -d ${D}${bindir}
     install -m 755 ${WORKDIR}/runWeston ${D}${bindir}
     rm -rf ${D}${systemd_system_unitdir}
-
+ 
     install -d ${D}${sysconfdir}/profile.d
     install -m 0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}
     install -m 0644 ${WORKDIR}/wayland_env.sh ${D}${sysconfdir}/profile.d/
+    install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
+    sed -i 's#ROOTHOME#${ROOT_HOME}#' ${D}/${sysconfdir}/init.d/weston
+    
+    install -d ${D}${sysconfdir}/systemd/system
+    install -D -p -m0644 ${WORKDIR}/weston-init.service ${D}${sysconfdir}/systemd/system/weston.service
+    install -D -p -m0644 ${WORKDIR}/weston.socket ${D}${sysconfdir}/systemd/system
 }
 
-FILES:${PN}:remove = "${systemd_system_unitdir}/weston.service ${systemd_system_unitdir}/weston.socket"
-FILES:${PN} += "${sysconfdir}/profile.d/* ${sysconfdir}/weston.ini"
-SYSTEMD_SERVICE:${PN}:remove = "weston.service weston.socket"
+FILES:${PN} += "${sysconfdir}/profile.d/* ${sysconfdir}/weston.ini ${sysconfdir}/systemd/system/weston.service ${sysconfdir}/systemd/system/weston.socket"
+
+SYSTEMD_SERVICE:${PN} = "weston.service"
+
+INITSCRIPT_NAME = ""
+INITSCRIPT_PARAMS = ""
diff --git a/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-init.service b/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-init.service
new file mode 100644
index 00000000..d4c7d472
--- /dev/null
+++ b/meta-arago-distro/recipes-graphics/wayland/weston-init/weston-init.service
@@ -0,0 +1,10 @@ 
+[Unit]
+Description=Systemd Service to Start Weston
+
+[Service]
+Type=forking
+ExecStart=/etc/init.d/weston start
+StandardOutput=journal
+
+[Install]
+WantedBy=multi-user.target