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

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

# We need to source this so that the login screens get translated
[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n

# Run preferred X display manager
preferred=
splash_quit_command=""
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

		# KDM supports "old-style" transition
		splash_quit_command="plymouth quit --retain-splash"
	elif [ "$DISPLAYMANAGER" = WDM ]; then
		preferred=/usr/bin/wdm
		splash_quit_command="plymouth quit"
	elif [ "$DISPLAYMANAGER" = XDM ]; then
	        preferred=/usr/bin/xdm
		splash_quit_command="plymouth quit"
        elif [ -n "$DISPLAYMANAGER" ]; then
		preferred=$DISPLAYMANAGER
		splash_quit_command="plymouth quit"
	fi
fi

# shut down boot splash
$splash_quit_command

shopt -s execfail

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

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

for pkg in $(rpm -q --qf "%{NAME}\n" --whatprovides "service(graphical-login)"| LC_ALL=C sort -u) ; do
	dm=$(rpm -q --provides $pkg | awk '/^service\(graphical-login\)/ { print $3 ; exit }')
	if [ -n "$dm" ]; then
		exec $dm "$@" >/dev/null 2>&1 </dev/null
	else
		exec $pkg "$@" >/dev/null 2>&1 </dev/null
	fi
done

# catch all exit error
exit 1