summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm')
-rwxr-xr-xmeta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm58
1 files changed, 58 insertions, 0 deletions
diff --git a/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm
new file mode 100755
index 0000000000..69ea949724
--- /dev/null
+++ b/meta/recipes-graphics/x11-common/xserver-nodm-init/xserver-nodm
@@ -0,0 +1,58 @@
1#!/bin/sh
2#
3### BEGIN INIT INFO
4# Provides: xserver
5# Required-Start: $local_fs $remote_fs dbus
6# Required-Stop: $local_fs $remote_fs
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9### END INIT INFO
10
11killproc() { # kill the named process(es)
12 pid=`/bin/pidof $1`
13 [ "$pid" != "" ] && kill $pid
14}
15
16read CMDLINE < /proc/cmdline
17for x in $CMDLINE; do
18 case $x in
19 x11=false)
20 echo "X Server disabled"
21 exit 0;
22 ;;
23 esac
24done
25
26case "$1" in
27 start)
28 . /etc/profile
29 username=root
30 echo "Starting Xserver"
31 if [ -f /etc/X11/Xusername ]; then
32 username=`cat /etc/X11/Xusername`
33 fi
34 # Using sudo -i here has the nice side effect of making sire
35 # HOME, USER and other previously problematic variables
36 # are set correctly
37 sudo -b -i -u $username /etc/X11/Xserver
38 # Wait for the desktop to say its finished loading
39 dbus-wait org.matchbox_project.desktop Loaded
40 ;;
41
42 stop)
43 echo "Stopping XServer"
44 killproc xinit
45 ;;
46
47 restart)
48 $0 stop
49 sleep 1
50 $0 start
51 ;;
52
53 *)
54 echo "usage: $0 { start | stop | restart }"
55 ;;
56esac
57
58exit 0