diff options
author | Max Krummenacher <max.krummenacher@toradex.com> | 2019-05-29 20:05:35 +0200 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2019-05-29 20:05:35 +0200 |
commit | be5b0af7fa7fa341363e0ccfe0c7f8a85213d37f (patch) | |
tree | f4ce1d362df034210608c39e9206f3b68ee0e0a7 /recipes-graphics | |
parent | c8aea6d76d570377053854ca4f722395236aa095 (diff) |
wayland-app-launch: add a simple systemd service
This tries to start a wayland application after weston got started.
Create a copy of wayland-terminal-launch_1.0.bb with the variables
changed according to your needs.
Signed-off-by: Max Krummenacher <max.krummenacher@toradex.com>
Diffstat (limited to 'recipes-graphics')
4 files changed, 62 insertions, 0 deletions
diff --git a/recipes-graphics/wayland-app-launch/wayland-app-launch.inc b/recipes-graphics/wayland-app-launch/wayland-app-launch.inc new file mode 100644 index 0000000..20a6c25 --- /dev/null +++ b/recipes-graphics/wayland-app-launch/wayland-app-launch.inc @@ -0,0 +1,29 @@ +SUMMARY = "Wayland application autostart" +DESCRIPTION = "This will start a wayland application after the wayland socket has been created." +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +inherit allarch systemd + +RDEPENDS_${PN} += "weston-init ${INITIAL_APP_PKGS}" + +S = "${WORKDIR}" + +SRC_URI = " \ + file://wayland-app-launch.service \ + file://wayland-app-launch.sh.in \ +" +FILESEXTRAPATHS_prepend := "${THISDIR}/wayland-app-launch:" + +do_compile () { + sed -e "s:@@wayland-application@@:${WAYLAND_APPLICATION}:" wayland-app-launch.sh.in > wayland-app-launch.sh +} + +do_install () { + install -d ${D}/${bindir} ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/wayland-app-launch.service ${D}${systemd_unitdir}/system + install -m 0755 ${S}/wayland-app-launch.sh ${D}/${bindir} +} + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "wayland-app-launch.service" diff --git a/recipes-graphics/wayland-app-launch/wayland-app-launch/wayland-app-launch.service b/recipes-graphics/wayland-app-launch/wayland-app-launch/wayland-app-launch.service new file mode 100644 index 0000000..d41615b --- /dev/null +++ b/recipes-graphics/wayland-app-launch/wayland-app-launch/wayland-app-launch.service @@ -0,0 +1,11 @@ +[Unit] +Description=Start a wayland application +After=weston.service +Requires=weston.service + +[Service] +Type=forking +ExecStart=/usr/bin/wayland-app-launch.sh + +[Install] +WantedBy=multi-user.target diff --git a/recipes-graphics/wayland-app-launch/wayland-app-launch/wayland-app-launch.sh.in b/recipes-graphics/wayland-app-launch/wayland-app-launch/wayland-app-launch.sh.in new file mode 100644 index 0000000..411184b --- /dev/null +++ b/recipes-graphics/wayland-app-launch/wayland-app-launch/wayland-app-launch.sh.in @@ -0,0 +1,14 @@ +#!/bin/sh +if test -z "$XDG_RUNTIME_DIR"; then + export XDG_RUNTIME_DIR=/run/user/`id -u` + if ! test -d "$XDG_RUNTIME_DIR"; then + mkdir --parents $XDG_RUNTIME_DIR + chmod 0700 $XDG_RUNTIME_DIR + fi +fi + +# wait for weston +while [ ! -e $XDG_RUNTIME_DIR/wayland-0 ] ; do sleep 0.1; done +sleep 0.5 + +@@wayland-application@@ diff --git a/recipes-graphics/wayland-app-launch/wayland-terminal-launch_1.0.bb b/recipes-graphics/wayland-app-launch/wayland-terminal-launch_1.0.bb new file mode 100644 index 0000000..6b669a0 --- /dev/null +++ b/recipes-graphics/wayland-app-launch/wayland-terminal-launch_1.0.bb @@ -0,0 +1,8 @@ +# set the following variable to your one and only application which should +# be launched right after weston started + +INITIAL_APP_PKGS ?= "weston" +INITIAL_PATH ?= "" +WAYLAND_APPLICATION ?= "/usr/bin/weston-terminal" + +require wayland-app-launch.inc |