aboutsummaryrefslogtreecommitdiffstats
path: root/prefdm
blob: b2a5c3f1f8b28fdcbc6230abceaf4bb87c6d32f0 (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
#!/bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin

# shut down any graphical boot that might exist
if [ -x /usr/bin/rhgb-client ]; then
    /usr/bin/rhgb-client --quit
fi

# We need to source this so that the login screens get translated
[ -f /etc/profile.d/lang.sh ] && . /etc/profile.d/lang.sh

# Run preferred X display manager
preferred=
if [ -f /etc/sysconfig/desktop ]; then
	. /etc/sysconfig/desktop
	if [ "$DISPLAYMANAGER" = GNOME ]; then
		preferred=/usr/sbin/gdm
	elif [ "$DISPLAYMANAGER" = KDE ]; then
		preferred=/usr/bin/kdm
	elif [ "$DISPLAYMANAGER" = XDM ]; then
	        preferred=/usr/bin/xdm
        elif [ -n "$DISPLAYMANAGER" ]; then
		preferred=$DISPLAYMANAGER
	fi
fi

shopt -s execfail

[ -n "$preferred" ] && exec $preferred "$@" >/dev/null 2>&1

# Fallbacks, in order
exec gdm "$@" >/dev/null 2>&1
exec kdm "$@" >/dev/null 2>&1
exec xdm "$@" >/dev/null 2>&1

# catch all exit error
exit 1