diff options
| author | Ross Burton <ross.burton@arm.com> | 2025-03-04 11:12:32 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-03-05 21:26:54 +0000 |
| commit | ff49596df417830969edd78a69c0e3dc8689bea8 (patch) | |
| tree | 475169568ccfe5dcdffeba45a2852dd21d21b405 /meta/recipes-graphics | |
| parent | 77415816bc51abbbb37dcc2a0546d9b33ccd665a (diff) | |
| download | poky-ff49596df417830969edd78a69c0e3dc8689bea8.tar.gz | |
weston-init: improve XDG_RUNTIME_DIR fallback creation
Sanity-check the permissions of the directory already exists, and clean
up the creation code.
(From OE-Core rev: a977c2a61dfabed9be061d742797248448aa5ade)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-graphics')
| -rwxr-xr-x | meta/recipes-graphics/wayland/weston-init/weston-start | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/meta/recipes-graphics/wayland/weston-init/weston-start b/meta/recipes-graphics/wayland/weston-init/weston-start index 01670cd4f5..3b13a0047a 100755 --- a/meta/recipes-graphics/wayland/weston-init/weston-start +++ b/meta/recipes-graphics/wayland/weston-init/weston-start | |||
| @@ -58,14 +58,19 @@ fi | |||
| 58 | 58 | ||
| 59 | if test -z "$XDG_RUNTIME_DIR"; then | 59 | if test -z "$XDG_RUNTIME_DIR"; then |
| 60 | export XDG_RUNTIME_DIR=/run/user/`id -u ${WESTON_USER}` | 60 | export XDG_RUNTIME_DIR=/run/user/`id -u ${WESTON_USER}` |
| 61 | if ! test -d "$XDG_RUNTIME_DIR"; then | 61 | if test -d "$XDG_RUNTIME_DIR"; then |
| 62 | mkdir --parents $XDG_RUNTIME_DIR | 62 | # Check permissions on existing directory |
| 63 | chmod 0700 $XDG_RUNTIME_DIR | 63 | if [ "$(stat -c %u-%a "$XDG_RUNTIME_DIR")" != "$(id -u ${WESTON_USER})-700" ]; then |
| 64 | fi | 64 | echo "ERROR: $XDG_RUNTIME_DIR has incorrect permissions" |
| 65 | if [ -n "$WESTON_USER" ] | 65 | exit 1 |
| 66 | then | 66 | fi |
| 67 | chown $WESTON_USER:$WESTON_GROUP $XDG_RUNTIME_DIR | 67 | else |
| 68 | mkdir --mode 0700 --parents $XDG_RUNTIME_DIR | ||
| 69 | if [ -n "$WESTON_USER" ] | ||
| 70 | then | ||
| 71 | chown $WESTON_USER:$WESTON_GROUP $XDG_RUNTIME_DIR | ||
| 72 | fi | ||
| 68 | fi | 73 | fi |
| 69 | fi | 74 | fi |
| 70 | 75 | ||
| 71 | su -c "XDG_RUNTIME_DIR=/run/user/`id -u ${WESTON_USER}` weston $weston_args --log=/tmp/weston.log" $WESTON_USER | 76 | su -c "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR weston $weston_args --log=/tmp/weston.log" $WESTON_USER |
