aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm
blob: d2e2f866c342aa031b6ff84c62105f874d6dc5b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh

. /etc/init.d/functions

for x in $(cat /proc/cmdline); do
        case $x in
        x11=false)
		echo "X Server disabled" 
		exit 0;
                ;;
        esac
done

case "$1" in
  start)
    # We don't want this script to block the rest of the boot process
    if [ "$2" != "background" ]; then
      $0 $1 background &
    else
       # work around from /etc/X11/Xinit
       export USER=root
       export HOME=/home/root
       if [ ! -d $HOME ] && [ -d /root ]; then
         HOME=/root
       fi

       . /etc/profile

       echo "Starting Xserver"
       . /etc/X11/xserver-common
       xinit /etc/X11/Xsession -- `which $XSERVER` $ARGS >/var/log/Xsession.log 2>&1
    fi 
  ;;

  stop)
        echo "Stopping XServer"
        killproc xinit
  ;;

  restart)
	$0 stop
        sleep 1
        $0 start
  ;;

  *)
        echo "usage: $0 { start | stop | restart }"
  ;;
esac

exit 0