[CentOS] prefdm still unfinished?

Fri Mar 16 21:58:07 UTC 2007
Rody <rody at xs4all.nl>

After testing the beta of CentOS 5, i was a little surprised to notice that 
the display manager part of the prefdm file in /etc/X11 was exactly like in 
CentOS 4 / RHEL4 and previous versions including RH9.

it reads like this (added line numbers for reference):

14 # Run preferred X display manager
15 preferred=
16 if [ -f /etc/sysconfig/desktop ]; then
17 	. /etc/sysconfig/desktop
18 	if [ "$DISPLAYMANAGER" = GNOME ]; then
19 		preferred=gdm
20 	elif [ "$DISPLAYMANAGER" = KDE ]; then
21 		preferred=kdm
22 	elif [ "$DISPLAYMANAGER" = XDM ]; then
23 	        preferred=xdm
24 	fi
25 fi

Line 17 is no functional command i know of, therefor the choice of which 
displaymanager (login-screen) to use is decided by the fallback lines later 
in the script (that starts with gdm). If you're ok with gdm, than there's no 
need for this to change. 

Still, it would seem that something is missing there. 
My best guess for what was supposed to be there:

# Run preferred X display manager
preferred=
if [ -f /etc/sysconfig/desktop ]; then
	DISPLAYMANAGER=$(cat /etc/sysconfig/desktop | grep DESKTOP | cut -d '"' -f2)
	if [ "$DISPLAYMANAGER" = GNOME ]; then
		preferred=gdm
	elif [ "$DISPLAYMANAGER" = KDE ]; then
		preferred=kdm
	elif [ "$DISPLAYMANAGER" = XDM ]; then
	        preferred=xdm
	fi
fi

This would make kdm your display manager when using kde as default desktop and 
gdm when using gnome. Although the grep part is not necessary, i added it in 
case someone decides to add lines to the desktop file someday...

I've come across one forum post in which someone suggested to add the line 
DISPLAYMANAGER="KDM" to the desktop file in order to achieve the same result. 
For this to work the prefdm file should be altered like this:

# Run preferred X display manager
preferred=
if [ -f /etc/sysconfig/desktop ]; then
	if [ -n "$(cat /etc/sysconfig/desktop | grep DISPLAYMANAGER | cut -d '"' 
-f2)" ];then
		DISPLAYMANAGER=$(cat /etc/sysconfig/desktop | grep DISPLAYMANAGER | cut -d 
'"' -f2)
		if [ "$DISPLAYMANAGER" = GDM ]; then
			preferred=gdm
		elif [ "$DISPLAYMANAGER" = KDM ]; then
			preferred=kdm
		elif [ "$DISPLAYMANAGER" = XDM ]; then
			preferred=xdm
		fi
	else
		DISPLAYMANAGER=$(cat /etc/sysconfig/desktop | grep DESKTOP | cut -d '"' -f2)
		if [ "$DISPLAYMANAGER" = GNOME ]; then
			preferred=gdm
		elif [ "$DISPLAYMANAGER" = KDE ]; then
			preferred=kdm
		elif [ "$DISPLAYMANAGER" = XDM ]; then
			preferred=xdm
		fi
	fi
fi

It all seems basic scripting to me so i wonder if no-one simply never noticed 
or never cared to finish this one.

Rody