Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Daniel Díaz" <daniel.diaz@linaro.org>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] RFC: weston-init: Update systemd service unit.
Date: Fri,  9 Dec 2016 12:20:18 -0600	[thread overview]
Message-ID: <1481307618-11526-1-git-send-email-daniel.diaz@linaro.org> (raw)

Based on the "ultimate" systemd service unit [1], this unit
works without the need of weston-start/weston-launch, as is
recommended by Weston developers.

It handles:
* proper VT/tty allocation and handling,
* PAM login (XDG environment settings),
* correct logging,
* optional arguments to Weston via config file.

[1] https://phabricator.freedesktop.org/T63

Signed-off-by: Daniel Díaz <daniel.diaz@linaro.org>
---
 meta/recipes-graphics/wayland/weston-init.bb       |  6 +++++
 .../wayland/weston-init/weston.service             | 31 +++++++++++++++++++---
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index 22ba5f3..4a97eba 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -10,7 +10,13 @@ S = "${WORKDIR}"
 
 do_install() {
 	install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston
+
+	# Install weston.service systemd service unit
 	install -Dm0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service
+	sed -i  -e 's,/usr/bin,${bindir},g' \
+		-e 's,/etc,${sysconfdir},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
diff --git a/meta/recipes-graphics/wayland/weston-init/weston.service b/meta/recipes-graphics/wayland/weston-init/weston.service
index 689ce41..66d49ec 100644
--- a/meta/recipes-graphics/wayland/weston-init/weston.service
+++ b/meta/recipes-graphics/wayland/weston-init/weston.service
@@ -1,12 +1,37 @@
 [Unit]
-Description=Weston Wayland Compositor
+Description=Weston Wayland Compositor (on tty7)
 RequiresMountsFor=/run
+Conflicts=getty@tty7.service plymouth-quit.service
+After=systemd-user-sessions.service getty@tty7.service plymouth-quit-wait.service
 
 [Service]
 User=root
+PermissionsStartOnly=true
+
+# Log us in via PAM so we get our XDG & co. environment and
+# are treated as logged in so we can use the tty:
+PAMName=login
+
+# Grab tty7
+UtmpIdentifier=tty7
+TTYPath=/dev/tty7
+TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
+
+# stderr to journal so our logging doesn't get thrown into /dev/null
+StandardOutput=tty
+StandardInput=tty
+StandardError=journal
+
 EnvironmentFile=-/etc/default/weston
-ExecStart=/usr/bin/weston-start -v -e -- $OPTARGS
+
+# Weston does not successfully change VT, nor does systemd place us on
+# the VT it just activated for us. Switch manually:
+ExecStartPre=/usr/bin/chvt 7
+ExecStart=/usr/bin/weston --log=/var/log/weston.log $OPTARGS
+
+IgnoreSIGPIPE=no
 
 [Install]
 WantedBy=multi-user.target
-
-- 
1.9.1



                 reply	other threads:[~2016-12-09 18:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481307618-11526-1-git-send-email-daniel.diaz@linaro.org \
    --to=daniel.diaz@linaro.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox