Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] weston-init: Fix tab indentation
@ 2019-05-09 10:03 Breno Leitao
  2019-05-09 10:03 ` [PATCH 2/2] weston-init: Add support for non-root start Breno Leitao
  0 siblings, 1 reply; 2+ messages in thread
From: Breno Leitao @ 2019-05-09 10:03 UTC (permalink / raw)
  To: openembedded-core

From: Breno Leitao <leitao@debian.org>

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.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 .../wayland/weston-init/weston-start               | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/recipes-graphics/wayland/weston-init/weston-start b/meta/recipes-graphics/wayland/weston-init/weston-start
index e72fbaaac4..0c4fee23d5 100755
--- a/meta/recipes-graphics/wayland/weston-init/weston-start
+++ b/meta/recipes-graphics/wayland/weston-init/weston-start
@@ -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
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] weston-init: Add support for non-root start
  2019-05-09 10:03 [PATCH 1/2] weston-init: Fix tab indentation Breno Leitao
@ 2019-05-09 10:03 ` Breno Leitao
  0 siblings, 0 replies; 2+ messages in thread
From: Breno Leitao @ 2019-05-09 10:03 UTC (permalink / raw)
  To: openembedded-core

From: Breno Leitao <leitao@debian.org>

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.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 .../wayland/weston-init/weston-start            | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-graphics/wayland/weston-init/weston-start b/meta/recipes-graphics/wayland/weston-init/weston-start
index 0c4fee23d5..86c68fc533 100755
--- a/meta/recipes-graphics/wayland/weston-init/weston-start
+++ b/meta/recipes-graphics/wayland/weston-init/weston-start
@@ -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
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-09 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-09 10:03 [PATCH 1/2] weston-init: Fix tab indentation Breno Leitao
2019-05-09 10:03 ` [PATCH 2/2] weston-init: Add support for non-root start Breno Leitao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox