mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 13:29:49 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
77415816bc
commit
ff49596df4
@@ -58,14 +58,19 @@ fi
|
|||||||
|
|
||||||
if test -z "$XDG_RUNTIME_DIR"; then
|
if test -z "$XDG_RUNTIME_DIR"; then
|
||||||
export XDG_RUNTIME_DIR=/run/user/`id -u ${WESTON_USER}`
|
export XDG_RUNTIME_DIR=/run/user/`id -u ${WESTON_USER}`
|
||||||
if ! test -d "$XDG_RUNTIME_DIR"; then
|
if test -d "$XDG_RUNTIME_DIR"; then
|
||||||
mkdir --parents $XDG_RUNTIME_DIR
|
# Check permissions on existing directory
|
||||||
chmod 0700 $XDG_RUNTIME_DIR
|
if [ "$(stat -c %u-%a "$XDG_RUNTIME_DIR")" != "$(id -u ${WESTON_USER})-700" ]; then
|
||||||
fi
|
echo "ERROR: $XDG_RUNTIME_DIR has incorrect permissions"
|
||||||
if [ -n "$WESTON_USER" ]
|
exit 1
|
||||||
then
|
fi
|
||||||
chown $WESTON_USER:$WESTON_GROUP $XDG_RUNTIME_DIR
|
else
|
||||||
|
mkdir --mode 0700 --parents $XDG_RUNTIME_DIR
|
||||||
|
if [ -n "$WESTON_USER" ]
|
||||||
|
then
|
||||||
|
chown $WESTON_USER:$WESTON_GROUP $XDG_RUNTIME_DIR
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
su -c "XDG_RUNTIME_DIR=/run/user/`id -u ${WESTON_USER}` weston $weston_args --log=/tmp/weston.log" $WESTON_USER
|
su -c "XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR weston $weston_args --log=/tmp/weston.log" $WESTON_USER
|
||||||
|
|||||||
Reference in New Issue
Block a user