diff options
Diffstat (limited to 'meta/recipes-graphics/wayland/weston-init')
4 files changed, 35 insertions, 29 deletions
diff --git a/meta/recipes-graphics/wayland/weston-init/init b/meta/recipes-graphics/wayland/weston-init/init index d3e87c6cef..a5c54e001e 100644 --- a/meta/recipes-graphics/wayland/weston-init/init +++ b/meta/recipes-graphics/wayland/weston-init/init | |||
@@ -30,8 +30,9 @@ done | |||
30 | case "$1" in | 30 | case "$1" in |
31 | start) | 31 | start) |
32 | . /etc/profile | 32 | . /etc/profile |
33 | export HOME=ROOTHOME | ||
33 | 34 | ||
34 | weston-start -- $OPTARGS | 35 | WESTON_USER=weston weston-start $OPTARGS & |
35 | ;; | 36 | ;; |
36 | 37 | ||
37 | stop) | 38 | stop) |
diff --git a/meta/recipes-graphics/wayland/weston-init/weston-socket.sh b/meta/recipes-graphics/wayland/weston-init/weston-socket.sh new file mode 100755 index 0000000000..86389d63a3 --- /dev/null +++ b/meta/recipes-graphics/wayland/weston-init/weston-socket.sh | |||
@@ -0,0 +1,20 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # set weston variables for use with global weston socket | ||
4 | global_socket="/run/wayland-0" | ||
5 | if [ -e "$global_socket" ]; then | ||
6 | weston_group=$(stat -c "%G" "$global_socket") | ||
7 | if [ "$(id -u)" = "0" ]; then | ||
8 | export WAYLAND_DISPLAY="$global_socket" | ||
9 | else | ||
10 | case "$(groups "$USER")" in | ||
11 | *"$weston_group"*) | ||
12 | export WAYLAND_DISPLAY="$global_socket" | ||
13 | ;; | ||
14 | *) | ||
15 | ;; | ||
16 | esac | ||
17 | fi | ||
18 | unset weston_group | ||
19 | fi | ||
20 | unset global_socket | ||
diff --git a/meta/recipes-graphics/wayland/weston-init/weston-start b/meta/recipes-graphics/wayland/weston-init/weston-start index 0b93dc964a..01670cd4f5 100755 --- a/meta/recipes-graphics/wayland/weston-init/weston-start +++ b/meta/recipes-graphics/wayland/weston-init/weston-start | |||
@@ -6,7 +6,7 @@ export PATH="/sbin:/usr/sbin:/bin:/usr/bin" | |||
6 | 6 | ||
7 | usage() { | 7 | usage() { |
8 | cat <<EOF | 8 | cat <<EOF |
9 | $0 [<openvt arguments>] [-- <weston options>] | 9 | $0 [<weston options>] |
10 | EOF | 10 | EOF |
11 | } | 11 | } |
12 | 12 | ||
@@ -18,9 +18,12 @@ add_weston_argument() { | |||
18 | weston_args="$weston_args $1" | 18 | weston_args="$weston_args $1" |
19 | } | 19 | } |
20 | 20 | ||
21 | # Add openvt extra argument | 21 | ## Add module to --modules argument |
22 | add_openvt_argument() { | 22 | add_weston_module() { |
23 | openvt_args="$openvt_args $1" | 23 | if [[ "x${weston_modules}" == "x" ]]; then |
24 | weston_modules="--modules " | ||
25 | fi; | ||
26 | weston_modules+="${1}," | ||
24 | } | 27 | } |
25 | 28 | ||
26 | if [ -n "$WAYLAND_DISPLAY" ]; then | 29 | if [ -n "$WAYLAND_DISPLAY" ]; then |
@@ -29,33 +32,12 @@ if [ -n "$WAYLAND_DISPLAY" ]; then | |||
29 | fi | 32 | fi |
30 | 33 | ||
31 | if [ -n "$WESTON_USER" ]; then | 34 | if [ -n "$WESTON_USER" ]; then |
32 | if [ -z "$WESTON_TTY" ]; then | ||
33 | echo "ERROR: If you have WESTON_USER variable set, you also need WESTON_TTY." | ||
34 | exit 1 | ||
35 | fi | ||
36 | if [ -z "$WESTON_GROUP" ]; then | 35 | if [ -z "$WESTON_GROUP" ]; then |
37 | # no explicit WESTON_GROUP given, therefore use WESTON_USER | 36 | # no explicit WESTON_GROUP given, therefore use WESTON_USER |
38 | export WESTON_GROUP="${WESTON_USER}" | 37 | export WESTON_GROUP="${WESTON_USER}" |
39 | fi | 38 | fi |
40 | weston_args_user="-u $WESTON_USER -t $WESTON_TTY" | ||
41 | fi | ||
42 | |||
43 | if [ -n "$DISPLAY" ]; then | ||
44 | launcher="weston" | ||
45 | else | ||
46 | launcher="weston-launch $weston_args_user --" | ||
47 | fi | 39 | fi |
48 | 40 | ||
49 | openvt_args="-s" | ||
50 | while [ -n "$1" ]; do | ||
51 | if [ "$1" = "--" ]; then | ||
52 | shift | ||
53 | break | ||
54 | fi | ||
55 | openvt_args="$openvt_args $1" | ||
56 | shift | ||
57 | done | ||
58 | |||
59 | weston_args=$* | 41 | weston_args=$* |
60 | 42 | ||
61 | # Load and run modules | 43 | # Load and run modules |
@@ -68,6 +50,9 @@ if [ -d "$modules_dir" ]; then | |||
68 | 50 | ||
69 | # process module | 51 | # process module |
70 | . $m | 52 | . $m |
53 | if [[ x"{$weston_modules}" != "x" ]]; then | ||
54 | add_weston_argument "${weston_modules}" | ||
55 | fi; | ||
71 | done | 56 | done |
72 | fi | 57 | fi |
73 | 58 | ||
@@ -83,4 +68,4 @@ if test -z "$XDG_RUNTIME_DIR"; then | |||
83 | fi | 68 | fi |
84 | fi | 69 | fi |
85 | 70 | ||
86 | exec openvt $openvt_args -- $launcher $weston_args --log=@LOCALSTATEDIR@/log/weston.log | 71 | su -c "XDG_RUNTIME_DIR=/run/user/`id -u ${WESTON_USER}` weston $weston_args --log=/tmp/weston.log" $WESTON_USER |
diff --git a/meta/recipes-graphics/wayland/weston-init/weston.service b/meta/recipes-graphics/wayland/weston-init/weston.service index e09625b31c..80745998ed 100644 --- a/meta/recipes-graphics/wayland/weston-init/weston.service +++ b/meta/recipes-graphics/wayland/weston-init/weston.service | |||
@@ -37,8 +37,8 @@ EnvironmentFile=/etc/default/weston | |||
37 | ExecStart=/usr/bin/weston --modules=systemd-notify.so | 37 | ExecStart=/usr/bin/weston --modules=systemd-notify.so |
38 | 38 | ||
39 | # Optional watchdog setup | 39 | # Optional watchdog setup |
40 | TimeoutStartSec=60 | 40 | #TimeoutStartSec=60 |
41 | WatchdogSec=20 | 41 | #WatchdogSec=20 |
42 | 42 | ||
43 | # The user to run Weston as. | 43 | # The user to run Weston as. |
44 | User=weston | 44 | User=weston |