Skip to contentSkip to conversation

weston-init: add a native systemd unit file

PATCH In review Alexander Kanavin 3 participants 3 messages Nov 30, 2015 – Dec 1, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 weston-init: add a native systemd unit file

Previously weston was started by systemd via a classic init script

[YOCTO #5582]

---
 meta/recipes-graphics/wayland/weston-init.bb             | 13 ++++++++++---
 meta/recipes-graphics/wayland/weston-init/weston.service | 15 +++++++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-graphics/wayland/weston-init/weston.service
meta/recipes-graphics/wayland/weston-init.bb +10 -3
index fc2e4f8..35fd055 100644
@@ -1,17 +1,22 @@
-SUMMARY = "Startup script for the Weston Wayland compositor"
+SUMMARY = "Startup script and systemd unit file for the Weston Wayland compositor"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
 
-SRC_URI = "file://init"
+SRC_URI = "file://init \
+           file://weston.service"
 
 S = "${WORKDIR}"
 
 do_install() {
 	install -d ${D}/${sysconfdir}/init.d
 	install -m755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
+
+        install -d ${D}${systemd_unitdir}/system
+        install -m0644 ${WORKDIR}/weston.service ${D}${systemd_unitdir}/system
 }
 
-inherit allarch update-rc.d distro_features_check
+inherit allarch update-rc.d distro_features_check systemd
+
 # rdepends on weston which depends on virtual/egl
 REQUIRED_DISTRO_FEATURES = "opengl"
 
@@ -19,3 +24,5 @@ RDEPENDS_${PN} = "weston kbd"
 
 INITSCRIPT_NAME = "weston"
 INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
+
+SYSTEMD_SERVICE_${PN} = "weston.service"
meta/recipes-graphics/wayland/weston-init/weston.service new file +15 -0
new file mode 100644
index 0000000..4f1f7ff
@@ -0,0 +1,15 @@
+[Unit]
+Description=Weston Wayland compositor startup
+RequiresMountsFor=/run
+
+[Service]
+User=root
+EnvironmentFile=-/etc/default/weston
+Environment="XDG_RUNTIME_DIR=/run/user/root"
+ExecStartPre=/bin/mkdir -p /run/user/root
+ExecStartPre=/bin/chmod 0700 /run/user/root
+ExecStart=/usr/bin/openvt -v -e /usr/bin/weston -- $OPTARGS
+
+[Install]
+WantedBy=multi-user.target
+
Signature · 1 line
2.6.2
#1 lore raw
Quoted 23 lines · Alexander Kanavin

Previously weston was started by systemd via a classic init script

[YOCTO #5582]

---
 meta/recipes-graphics/wayland/weston-init.bb             | 13 ++++++++++---
 meta/recipes-graphics/wayland/weston-init/weston.service | 15 +++++++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-graphics/wayland/weston-init/weston.service
meta/recipes-graphics/wayland/weston-init.bb +2 -2
index fc2e4f8..35fd055 100644
@@ -1,17 +1,22 @@
-SUMMARY = "Startup script for the Weston Wayland compositor"
+SUMMARY = "Startup script and systemd unit file for the Weston Wayland compositor"
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
 
-SRC_URI = "file://init"
+SRC_URI = "file://init \

meta/recipes-graphics/wayland/weston-init.bb line 15

Quoted 10 lines
meta/recipes-graphics/wayland/weston-init.bb +4 -0
+           file://weston.service"
 
 S = "${WORKDIR}"
 
 do_install() {
 	install -d ${D}/${sysconfdir}/init.d
 	install -m755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
+
+        install -d ${D}${systemd_unitdir}/system
+        install -m0644 ${WORKDIR}/weston.service ${D}${systemd_unitdir}/system

Don't mix tabs and spaces for indentation.

Quoted 43 lines
meta/recipes-graphics/wayland/weston-init.bb +4 -1
 }
 
-inherit allarch update-rc.d distro_features_check
+inherit allarch update-rc.d distro_features_check systemd
+
 # rdepends on weston which depends on virtual/egl
 REQUIRED_DISTRO_FEATURES = "opengl"
 
@@ -19,3 +24,5 @@ RDEPENDS_${PN} = "weston kbd"
 
 INITSCRIPT_NAME = "weston"
 INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
+
+SYSTEMD_SERVICE_${PN} = "weston.service"
meta/recipes-graphics/wayland/weston-init/weston.service new file +15 -0
new file mode 100644
index 0000000..4f1f7ff
@@ -0,0 +1,15 @@
+[Unit]
+Description=Weston Wayland compositor startup
+RequiresMountsFor=/run
+
+[Service]
+User=root
+EnvironmentFile=-/etc/default/weston
+Environment="XDG_RUNTIME_DIR=/run/user/root"
+ExecStartPre=/bin/mkdir -p /run/user/root
+ExecStartPre=/bin/chmod 0700 /run/user/root
+ExecStart=/usr/bin/openvt -v -e /usr/bin/weston -- $OPTARGS
+
+[Install]
+WantedBy=multi-user.target
+
Signature · 7 lines
2.6.2

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Signature · 1 line
Martin 'JaMa' Jansa     jabber: [email protected]
#2 lore raw
In reply to Alexander Kanavin

Hi,

Better use "${systemd_system_unitdir}" instead of
"${systemd_unitdir}/system".

Pau Espin Pedrol
mail/jabber: [email protected]
http://blog.espeweb.net

2015-11-30 18:41 GMT+01:00 Alexander Kanavin <
[email protected]>:

Quoted 85 lines

Previously weston was started by systemd via a classic init script

[YOCTO #5582]

---
 meta/recipes-graphics/wayland/weston-init.bb             | 13
++++++++++---
 meta/recipes-graphics/wayland/weston-init/weston.service | 15
+++++++++++++++
 2 files changed, 25 insertions(+), 3 deletions(-)
 create mode 100644

meta/recipes-graphics/wayland/weston-init/weston.service

meta/recipes-graphics/wayland/weston-init.bb +1 -1
index fc2e4f8..35fd055 100644
@@ -1,17 +1,22 @@
-SUMMARY = "Startup script for the Weston Wayland compositor"
+SUMMARY = "Startup script and systemd unit file for the Weston Wayland

compositor"
LICENSE = "MIT"
LIC_FILES_CHKSUM =
"file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"

meta/recipes-graphics/wayland/weston-init.bb +5 -1
-SRC_URI = "file://init"
+SRC_URI = "file://init \
+           file://weston.service"
 
 S = "${WORKDIR}"
 
 do_install() {
        install -d ${D}/${sysconfdir}/init.d
        install -m755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
+
+        install -d ${D}${systemd_unitdir}/system
+        install -m0644 ${WORKDIR}/weston.service

${D}${systemd_unitdir}/system
}

meta/recipes-graphics/wayland/weston-init.bb +4 -1
-inherit allarch update-rc.d distro_features_check
+inherit allarch update-rc.d distro_features_check systemd
+
 # rdepends on weston which depends on virtual/egl
 REQUIRED_DISTRO_FEATURES = "opengl"
@@ -19,3 +24,5 @@ RDEPENDS_${PN} = "weston kbd"
 
 INITSCRIPT_NAME = "weston"
 INITSCRIPT_PARAMS = "start 9 5 2 . stop 20 0 1 6 ."
+
+SYSTEMD_SERVICE_${PN} = "weston.service"
meta/recipes-graphics/wayland/weston-init/weston.service new file +15 -1
new file mode 100644
index 0000000..4f1f7ff
@@ -0,0 +1,15 @@
+[Unit]
+Description=Weston Wayland compositor startup
+RequiresMountsFor=/run
+
+[Service]
+User=root
+EnvironmentFile=-/etc/default/weston
+Environment="XDG_RUNTIME_DIR=/run/user/root"
+ExecStartPre=/bin/mkdir -p /run/user/root
+ExecStartPre=/bin/chmod 0700 /run/user/root
+ExecStart=/usr/bin/openvt -v -e /usr/bin/weston -- $OPTARGS
+
+[Install]
+WantedBy=multi-user.target
+
--

2.6.2

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core