summaryrefslogtreecommitdiff
path: root/recipes/xserver-kdrive-common/xserver-nodm-init/xserver-nodm
blob: 28ba65cd52e9d262ea8baed9be0cb3d0efad9da2 (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
#!/bin/sh

killproc() {            # kill the named process(es)
        pid=`/bin/ps -e x |
             /bin/grep $1 |
             /bin/grep -v grep |
             /bin/sed -e 's/^  *//' -e 's/ .*//'`
        [ "$pid" != "" ] && kill $pid
}

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

case "$1" in
  start)
        . /etc/profile
        [ -z $LOGNAME ] && export LOGNAME=root && export HOME=/home/root
        [ -z $HOME ] && export HOME=/home/$LOGNAME


        echo "Starting Xserver"
        /etc/X11/Xserver &
  ;;

  stop)
        echo "Stopping XServer"
        killproc xinit
  ;;

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

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

exit 0