Skip to contentSkip to conversation

weston-init: Fix tab indentation

PATCH New Breno Leitao 1 participant 2 messages May 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 weston-init: Fix tab indentation

From: Breno Leitao <[email protected]>

This patch simply fixes space and tab mixes. It converts space to tabs. This is being done since I am going to change the code in the next commit and I do not want to change more lines than it is required, thus, I am creating a commit just to fix indentation, so I can create a cleaner patch later.

---
 .../wayland/weston-init/weston-start               | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
meta/recipes-graphics/wayland/weston-init/weston-start +7 -7
index e72fbaaac4..0c4fee23d5 100755
@@ -5,8 +5,8 @@
 export PATH="/sbin:/usr/sbin:/bin:/usr/bin"
 
 usage() {
-    cat <<EOF
-    $0 [<openvt arguments>] [-- <weston options>]
+	cat <<EOF
+	$0 [<openvt arguments>] [-- <weston options>]
 EOF
 }
 
@@ -59,11 +59,11 @@ if [ -d "$modules_dir" ]; then
 fi
 
 if test -z "$XDG_RUNTIME_DIR"; then
-    export XDG_RUNTIME_DIR=/run/user/`id -u`
-    if ! test -d "$XDG_RUNTIME_DIR"; then
-        mkdir --parents $XDG_RUNTIME_DIR
-        chmod 0700 $XDG_RUNTIME_DIR
-    fi
+	export XDG_RUNTIME_DIR=/run/user/`id -u`
+	if ! test -d "$XDG_RUNTIME_DIR"; then
+		mkdir --parents $XDG_RUNTIME_DIR
+		chmod 0700 $XDG_RUNTIME_DIR
+	fi
 fi
 
 exec openvt $openvt_args -- $launcher $weston_args --log=@LOCALSTATEDIR@/log/weston.log
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 weston-init: Add support for non-root start

From: Breno Leitao <[email protected]>

This commit adds support for two variables (WESTON_USER and WESTON_TTY) that would be passed to weston_launch. It allows starting weston as a non-root user.

---
 .../wayland/weston-init/weston-start            | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
meta/recipes-graphics/wayland/weston-init/weston-start +15 -2
index 0c4fee23d5..86c68fc533 100755
@@ -27,10 +27,19 @@ if [ -n "$WAYLAND_DISPLAY" ]; then
 	echo "ERROR: A Wayland compositor is already running, nested Weston instance is not supported yet."
 	exit 1
 fi
+
+if [ -n "$WESTON_USER" ]; then
+	if [ -z "$WESTON_TTY" ]; then
+		echo "ERROR: If you have WESTON_USER variable set, you also need WESTON_TTY."
+		exit 1
+	fi
+	weston_args_user="-u $WESTON_USER -t $WESTON_TTY"
+fi
+
 if [ -n "$DISPLAY" ]; then
 	launcher="weston"
 else
-	launcher="weston-launch --"
+	launcher="weston-launch $weston_args_user --"
 fi
 
 openvt_args="-s"
@@ -59,11 +68,15 @@ if [ -d "$modules_dir" ]; then
 fi
 
 if test -z "$XDG_RUNTIME_DIR"; then
-	export XDG_RUNTIME_DIR=/run/user/`id -u`
+	export XDG_RUNTIME_DIR=/run/user/`id -u ${WESTON_USER}`
 	if ! test -d "$XDG_RUNTIME_DIR"; then
 		mkdir --parents $XDG_RUNTIME_DIR
 		chmod 0700 $XDG_RUNTIME_DIR
 	fi
+	if [ -n "$WESTON_USER" ]
+	then
+		chown $WEST_USER:$WESTON_USER $XDG_RUNTIME_DIR
+	fi
 fi
 
 exec openvt $openvt_args -- $launcher $weston_args --log=@LOCALSTATEDIR@/log/weston.log
Signature · 1 line
2.17.1