[OE-core] [<OE-core][PATCH v2 1/4] weston-init: Handle Weston startup correctly.
Tom Hochstein
tom.hochstein at freescale.com
Thu Dec 17 22:04:45 UTC 2015
Weston is started in different ways depending on the image
configuration and the runtime scenario. Refer to the weston man
page for more information.
Signed-off-by: Tom Hochstein <tom.hochstein at freescale.com>
---
meta/recipes-graphics/wayland/weston-init.bb | 15 ++++++++++++++-
meta/recipes-graphics/wayland/weston-init/init | 2 +-
meta/recipes-graphics/wayland/weston-init/weston-start | 18 ++++++++++++++++++
.../wayland/weston-init/weston.service | 4 ++--
4 files changed, 35 insertions(+), 4 deletions(-)
create mode 100644 meta/recipes-graphics/wayland/weston-init/weston-start
diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb
index 653541e..0bd3ad8 100644
--- a/meta/recipes-graphics/wayland/weston-init.bb
+++ b/meta/recipes-graphics/wayland/weston-init.bb
@@ -3,7 +3,8 @@ LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"
SRC_URI = "file://init \
- file://weston.service"
+ file://weston.service \
+ file://weston-start"
S = "${WORKDIR}"
@@ -13,6 +14,18 @@ do_install() {
install -d ${D}${systemd_system_unitdir}
install -m0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}
+
+ install -d ${D}/${bindir}
+ install -m755 ${WORKDIR}/weston-start ${D}/${bindir}
+ if [ "${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'xwayland', '', d)}" = "xwayland" ]; then
+ weston_launch_setup="mkdir -p /tmp/.X11-unix"
+ weston_launch_args="--modules=xwayland.so"
+ else
+ weston_launch_setup=""
+ weston_launch_args=""
+ fi
+ sed -i "s#WESTON_LAUNCH_SETUP#${weston_launch_setup}#" ${D}/${bindir}/weston-start
+ sed -i "s#WESTON_LAUNCH_ARGS#${weston_launch_args}#" ${D}/${bindir}/weston-start
}
inherit allarch update-rc.d distro_features_check systemd
diff --git a/meta/recipes-graphics/wayland/weston-init/init b/meta/recipes-graphics/wayland/weston-init/init
index 2e938f4..8567dfc 100644
--- a/meta/recipes-graphics/wayland/weston-init/init
+++ b/meta/recipes-graphics/wayland/weston-init/init
@@ -38,7 +38,7 @@ case "$1" in
chmod 0700 $XDG_RUNTIME_DIR
fi
- openvt -s weston -- $OPTARGS
+ weston-start
;;
stop)
diff --git a/meta/recipes-graphics/wayland/weston-init/weston-start b/meta/recipes-graphics/wayland/weston-init/weston-start
new file mode 100644
index 0000000..1360dd7
--- /dev/null
+++ b/meta/recipes-graphics/wayland/weston-init/weston-start
@@ -0,0 +1,18 @@
+#! /bin/sh
+
+# There are multiple ways to start weston.
+if [ "$WAYLAND_DISPLAY" ]; then
+ echo -e "\aError: Weston is already running."
+ echo "This script does not support launching Weston nested."
+ exit 1
+else
+ if [ "$DISPLAY" ]; then
+ echo "Launching Weston"
+ openvt -s -- sh -c "weston -- $OPTARGS > /var/log/weston.log 2>&1"
+ else
+ echo "Launching Weston"
+ export XDG_CONFIG_HOME=/etc
+ WESTON_LAUNCH_SETUP
+ openvt $OPENVT_ARGS -- sh -c "weston-launch -- WESTON_LAUNCH_ARGS $OPTARGS > /var/log/weston.log 2>&1"
+ fi
+fi
diff --git a/meta/recipes-graphics/wayland/weston-init/weston.service b/meta/recipes-graphics/wayland/weston-init/weston.service
index 4f1f7ff..856f91f 100644
--- a/meta/recipes-graphics/wayland/weston-init/weston.service
+++ b/meta/recipes-graphics/wayland/weston-init/weston.service
@@ -5,10 +5,10 @@ RequiresMountsFor=/run
[Service]
User=root
EnvironmentFile=-/etc/default/weston
-Environment="XDG_RUNTIME_DIR=/run/user/root"
+Environment="XDG_RUNTIME_DIR=/run/user/root" "OPENVT_ARGS=-w"
ExecStartPre=/bin/mkdir -p /run/user/root
ExecStartPre=/bin/chmod 0700 /run/user/root
-ExecStart=/usr/bin/openvt -v -e /usr/bin/weston -- $OPTARGS
+ExecStart=/usr/bin/weston-start
[Install]
WantedBy=multi-user.target
--
2.1.4
More information about the Openembedded-core
mailing list