diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2016-05-18 13:40:43 -0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-21 22:24:55 +0100 |
commit | 2f0283ab0d5e1065931b954dfea905cbc9edb720 (patch) | |
tree | d49c496da029660865b2d70a4477df399ba40036 /meta | |
parent | d46c5beedca8630e5080401925cb7902edf55efe (diff) | |
download | poky-2f0283ab0d5e1065931b954dfea905cbc9edb720.tar.gz |
weston-init: Rework init sequence to avoid code duplication
The new 'weston-start' script redcues the code duplication for SysV
and SystemD based images.
(From OE-Core rev: 1963dfb002b9e0b4bff02dbf783909102ca59719)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
4 files changed, 41 insertions, 13 deletions
diff --git a/meta/recipes-graphics/wayland/weston-init.bb b/meta/recipes-graphics/wayland/weston-init.bb index 4ad62cff2d..3a2251e69a 100644 --- a/meta/recipes-graphics/wayland/weston-init.bb +++ b/meta/recipes-graphics/wayland/weston-init.bb | |||
@@ -3,13 +3,15 @@ LICENSE = "MIT" | |||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690" | 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690" |
4 | 4 | ||
5 | SRC_URI = "file://init \ | 5 | SRC_URI = "file://init \ |
6 | file://weston.service" | 6 | file://weston.service \ |
7 | file://weston-start" | ||
7 | 8 | ||
8 | S = "${WORKDIR}" | 9 | S = "${WORKDIR}" |
9 | 10 | ||
10 | do_install() { | 11 | do_install() { |
11 | install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston | 12 | install -Dm755 ${WORKDIR}/init ${D}/${sysconfdir}/init.d/weston |
12 | install -Dm0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service | 13 | install -Dm0644 ${WORKDIR}/weston.service ${D}${systemd_system_unitdir}/weston.service |
14 | install -Dm755 ${WORKDIR}/weston-start ${D}${bindir}/weston-start | ||
13 | } | 15 | } |
14 | 16 | ||
15 | inherit allarch update-rc.d distro_features_check systemd | 17 | 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 2e938f4307..5c925f4541 100644 --- a/meta/recipes-graphics/wayland/weston-init/init +++ b/meta/recipes-graphics/wayland/weston-init/init | |||
@@ -31,14 +31,7 @@ case "$1" in | |||
31 | start) | 31 | start) |
32 | . /etc/profile | 32 | . /etc/profile |
33 | 33 | ||
34 | # This is all a nasty hack | 34 | weston-start -s -- $OPTARGS |
35 | if test -z "$XDG_RUNTIME_DIR"; then | ||
36 | export XDG_RUNTIME_DIR=/run/user/root | ||
37 | mkdir --parents $XDG_RUNTIME_DIR | ||
38 | chmod 0700 $XDG_RUNTIME_DIR | ||
39 | fi | ||
40 | |||
41 | openvt -s weston -- $OPTARGS | ||
42 | ;; | 35 | ;; |
43 | 36 | ||
44 | stop) | 37 | stop) |
diff --git a/meta/recipes-graphics/wayland/weston-init/weston-start b/meta/recipes-graphics/wayland/weston-init/weston-start new file mode 100755 index 0000000000..b791fd5a9b --- /dev/null +++ b/meta/recipes-graphics/wayland/weston-init/weston-start | |||
@@ -0,0 +1,36 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2016 O.S. Systems Software LTDA. | ||
3 | |||
4 | export PATH="/sbin:/usr/sbin:/bin:/usr/bin" | ||
5 | |||
6 | usage() { | ||
7 | cat <<EOF | ||
8 | $0 <openvt arguments> -- <weston options> | ||
9 | EOF | ||
10 | } | ||
11 | |||
12 | if test $# -lt 2; then | ||
13 | usage | ||
14 | exit 1 | ||
15 | fi | ||
16 | |||
17 | openvt_args="" | ||
18 | while [ -n "$1" ]; do | ||
19 | openvt_args="$openvt_args $1" | ||
20 | shift | ||
21 | |||
22 | if [ "$1" = "--" ]; then | ||
23 | shift | ||
24 | break | ||
25 | fi | ||
26 | done | ||
27 | |||
28 | weston_args=$* | ||
29 | |||
30 | if test -z "$XDG_RUNTIME_DIR"; then | ||
31 | export XDG_RUNTIME_DIR=/run/user/`id -u` | ||
32 | mkdir --parents $XDG_RUNTIME_DIR | ||
33 | chmod 0700 $XDG_RUNTIME_DIR | ||
34 | fi | ||
35 | |||
36 | exec openvt $openvt_args -- weston $weston_args --log=/var/log/weston.log | ||
diff --git a/meta/recipes-graphics/wayland/weston-init/weston.service b/meta/recipes-graphics/wayland/weston-init/weston.service index 12aedb7935..689ce41064 100644 --- a/meta/recipes-graphics/wayland/weston-init/weston.service +++ b/meta/recipes-graphics/wayland/weston-init/weston.service | |||
@@ -5,10 +5,7 @@ RequiresMountsFor=/run | |||
5 | [Service] | 5 | [Service] |
6 | User=root | 6 | User=root |
7 | EnvironmentFile=-/etc/default/weston | 7 | EnvironmentFile=-/etc/default/weston |
8 | Environment="XDG_RUNTIME_DIR=/run/user/root" | 8 | ExecStart=/usr/bin/weston-start -v -e -- $OPTARGS |
9 | ExecStartPre=/bin/mkdir -p /run/user/root | ||
10 | ExecStartPre=/bin/chmod 0700 /run/user/root | ||
11 | ExecStart=/usr/bin/openvt -v -e /usr/bin/weston -- $OPTARGS | ||
12 | 9 | ||
13 | [Install] | 10 | [Install] |
14 | WantedBy=multi-user.target | 11 | WantedBy=multi-user.target |