From 6ed027a31fe3b400e8f7b1f0b418672f67acff24 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 27 May 2009 11:45:22 +0100 Subject: xserver-nodm-init: Add ability to run X as a non-root user Signed-off-by: Richard Purdie --- meta/packages/x11-common/xserver-nodm-init.bb | 4 ++-- meta/packages/x11-common/xserver-nodm-init/xserver-nodm | 9 ++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'meta') diff --git a/meta/packages/x11-common/xserver-nodm-init.bb b/meta/packages/x11-common/xserver-nodm-init.bb index 521f17c5f..c9efb71b8 100644 --- a/meta/packages/x11-common/xserver-nodm-init.bb +++ b/meta/packages/x11-common/xserver-nodm-init.bb @@ -2,8 +2,8 @@ DESCRIPTION = "Simple Xserver Init Script (no dm)" LICENSE = "GPL" SECTION = "x11" PRIORITY = "optional" -PR = "r18" -RDEPENDS = "dbus-wait" +PR = "r21" +RDEPENDS_${PN} = "dbus-wait sudo" SRC_URI = "file://xserver-nodm" S = ${WORKDIR} diff --git a/meta/packages/x11-common/xserver-nodm-init/xserver-nodm b/meta/packages/x11-common/xserver-nodm-init/xserver-nodm index f6399fc1f..69ea94972 100755 --- a/meta/packages/x11-common/xserver-nodm-init/xserver-nodm +++ b/meta/packages/x11-common/xserver-nodm-init/xserver-nodm @@ -26,8 +26,15 @@ done case "$1" in start) . /etc/profile + username=root echo "Starting Xserver" - /etc/X11/Xserver & + if [ -f /etc/X11/Xusername ]; then + username=`cat /etc/X11/Xusername` + fi + # Using sudo -i here has the nice side effect of making sire + # HOME, USER and other previously problematic variables + # are set correctly + sudo -b -i -u $username /etc/X11/Xserver # Wait for the desktop to say its finished loading dbus-wait org.matchbox_project.desktop Loaded ;; -- cgit v1.2.3