summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2025-03-04 11:12:33 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-03-05 21:26:54 +0000
commit9be2fc0031b0c9eaee786a4f5f50600ad7dfa7e0 (patch)
tree5a9ada76c371c1468b37c1b41275e153bc7f7fe1 /meta/recipes-graphics
parentff49596df417830969edd78a69c0e3dc8689bea8 (diff)
downloadpoky-9be2fc0031b0c9eaee786a4f5f50600ad7dfa7e0.tar.gz
xserver-nodm-init: improve XDG_RUNTIME_DIR fallback creation
This directory must have mode 0700, and should be under /run/user (as recommended in the specification, and as weston-init does). Also check the permissions if the directory already exists and fail early if they're incorrect. [ YOCTO #13878 ] (From OE-Core rev: 5c98609bf7dfb05af722e30adb49731727df9a94) 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')
-rw-r--r--meta/recipes-graphics/x11-common/xserver-nodm-init/X11/Xsession.d/13xdgbasedirs.sh20
1 files changed, 13 insertions, 7 deletions
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/X11/Xsession.d/13xdgbasedirs.sh b/meta/recipes-graphics/x11-common/xserver-nodm-init/X11/Xsession.d/13xdgbasedirs.sh
index 6bd40b2fc5..912f79761c 100644
--- a/meta/recipes-graphics/x11-common/xserver-nodm-init/X11/Xsession.d/13xdgbasedirs.sh
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/X11/Xsession.d/13xdgbasedirs.sh
@@ -1,13 +1,19 @@
1# Minimal/stub implementation of the XDG Base Directory specification. 1# Minimal/stub implementation of the XDG Base Directory specification.
2# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html 2# http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
3#
4# Wayland needs XDG_RUNTIME_DIR, so set it to /tmp. This isn't compliant with
5# the specification (wrong mode, wrong owner) but it's mostly sufficient.
6#
7# In the ideal case where SystemD is booting and userspace is initiated by a
8# SystemD user session this will have been set already, so don't overwrite it.
9 3
4# If the runtime directory hasn't been set already (for example by systemd,
5# elogind, or pam) create a directory in TMPDIR.
10if [ -z "$XDG_RUNTIME_DIR" ]; then 6if [ -z "$XDG_RUNTIME_DIR" ]; then
11 XDG_RUNTIME_DIR="/tmp" 7 XDG_RUNTIME_DIR=/run/user/$(id -u)
12 export XDG_RUNTIME_DIR 8 export XDG_RUNTIME_DIR
13fi 9fi
10
11if [ -d "$XDG_RUNTIME_DIR" ]; then
12 # If the directory exists, check the permissions and ownership
13 if [ "$(stat -c %u-%a "$XDG_RUNTIME_DIR")" != "$(id -u)-700" ]; then
14 echo "ERROR: $XDG_RUNTIME_DIR has incorrect permissions"
15 exit 1
16 fi
17else
18 mkdir --mode 0700 --parents "${XDG_RUNTIME_DIR}"
19fi