@@ -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
@@ -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
-
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(-)