xserver-nodm-init: Add ability to run X as a non-root user

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Richard Purdie
2009-05-27 11:45:22 +01:00
parent 8f32595f6b
commit 6ed027a31f
2 changed files with 10 additions and 3 deletions

View File

@@ -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}

View File

@@ -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
;;