#!/bin/sh PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin HOME=/root export HOME # We need to source this so that the login screens get translated [ -f /etc/profile.d/10lang.sh ] && . /etc/profile.d/10lang.sh # trap SIGTERM to be able to kill autologin killed () { kill -15 $! exit } trap killed 15 # Run preferred X display manager # Try autologin first, if wanted... if [ -f /etc/sysconfig/autologin -a -x /usr/sbin/autologin ]; then . /etc/sysconfig/autologin if [ -n "$USER" -a "$AUTOLOGIN" = yes ]; then while true; do /usr/sbin/autologin & echo -n $$ > /var/lock/subsys/dm wait $! ; done fi fi # we have to assume that /etc/sysconfig/desktop has two variables, DESKTOP # and DISPLAYMANAGER because administors may prefer a specific DM regardless # of desktops. # DISPLAYMANAGER is referenced by this script, and DESKTOP is referenced # as system-wide default by /etc/X11/Xsession script only when X-session # is opened by "startx" command. # when DMs open an X-session, they send DESKTOP, which is in this case # directly selected by users, as a commandline argument of /etc/X11/Xsession. # actually Xsession script is only able to know by existance of its first # argument whether it is called by DM or "startx". see the logic # in /etc/X11/Xsession. # If DISPLAYMANAGER is not defined, then assume that it is the same as DESKTOP preferred= if [ -f /etc/sysconfig/desktop ]; then . /etc/sysconfig/desktop >/dev/null 2>&1 [ -z "$DISPLAYMANAGER" ] && DISPLAYMANAGER=$DESKTOP if [ "$DISPLAYMANAGER" = "GDM" -o "$DISPLAYMANAGER" = "gdm" -o "$DISPLAYMANAGER" = "GNOME" -o "$DISPLAYMANAGER" = "gnome" -o "$DISPLAYMANAGER" = "Gnome" ]; then preferred=gdm elif [ "$DISPLAYMANAGER" = "KDE" -o "$DISPLAYMANAGER" = "kde" ]; then preferred=mdkkdm elif [ "$DISPLAYMANAGER" = "KDM" -o "$DISPLAYMANAGER" = "kdm" ]; then preferred=kdm elif [ "$DISPLAYMANAGER" = "XDM" -o "$DISPLAYMANAGER" = "xdm" ] ; then preferred=xdm fi fi # xdm-like program are launched from the console, however, the locale-setting # can be done in a way that console is not localize, while X11 is. # That is handled by the lang.sh script, depending on the existance of # $DISPLAY or $DESKTOP variable. Now that $DESKTOP is defined resource lang.sh [ -z "$DESKTOP" ] && DESKTOP=dummy_DESKTOP_variable . /etc/profile.d/10lang.sh [ "$DESKTOP" = "dummy_DESKTOP_variable" ] && unset DESKTOP if [ -z "$preferred" ] || ! which $preferred >/dev/null 2>&1; then if which mdkkdm >/dev/null 2>&1; then preferred=mdkkdm elif which kdm >/dev/null 2>&1; then preferred=kdm elif which gdm >/dev/null 2>&1; then preferred=gdm elif which xdm >/dev/null 2>&1; then preferred=xdm fi fi if [ -n "$preferred" ]; then `which $preferred` -nodaemon $* >/dev/null 2>&1 & echo -n $! > /var/lock/subsys/dm fi exit 0