summaryrefslogtreecommitdiff
blob: b167e5a708a427d8439e514fe7fe37430f85ecec (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
52
53
54
55
56
57
58
59
60
61
#! /bin/bash
# Copyright (c) 1996-99 SuSE GmbH Nuernberg, Germany.  All rights reserved.
#
# Author: Florian La Roche <florian@suse.de>, 1996
#	  Werner Fink <werner@suse.de>, 1996,98,99
#         Martin Scherbaum <maddin@suse.de>, 1997
#         Reinhard Max <max@suse.de>, 1997
#
# /sbin/init.d/xdm
#

. /etc/rc.d/config/basic
. /etc/rc.d/config/functions

. /etc/profile.env
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:$ROOTPATH

case "$DISPLAYMANAGER" in
    kdm|kde|KDM|KDE)	 
	EXE=$KDEDIR/bin/kdm   
	;;
    gdm|GDM|Gnome|GNOME) 
	EXE=$GNOMEDIR/bin/gdm 
	;;
    *)	
	EXE=/usr/X11R6/bin/xdm ;;

esac

test ! -x "$EXE" && EXE=/usr/X11R6/bin/xdm

SERVICE=${EXE##*/}
PID="/var/run/xdm.pid"
opts="start stop restart"

start() {
	ebegin "Starting ${SERVICE}"
	start-stop-daemon --start --quiet --exe $EXE 1>&2
	if [ -n "$?" ] ; then
	    # After a crash or a kill signal we may have
  	    # a wrong owner ship of /dev/console
	    chown root:tty /dev/console /dev/tty0
	    chmod 622      /dev/console /dev/tty0
	else
	  eend $? "Error starting ${SERVICE}."
	fi
}

stop() {
	ebegin "Stopping ${SERVICE}"
	killall X
	start-stop-daemon --stop --quiet --exe $EXE 1>&2
	eend $? "Error stopping ${SERVICE}."
}

restart() {
	stop
	start
}

doservice ${@}