File init.earlygdm of Package gdm

#! /bin/sh
# Copyright (c) 2004 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# Author: Werner Fink <werner@suse.de>, 2004
#         Stephan Kulow <coolo@suse.de>, 2004
#         Robert Love, 2005
#
# Please send feedback to http://www.suse.de/feedback
#
# /etc/init.d/earlygdm
#
### BEGIN INIT INFO
# Provides:          earlygdm
# Required-Start:    earlysyslog earlykbd $local_fs
# Should-Start:      gpm firstboot resmgr
# Required-Stop:
# Default-Start:     5
# Default-Stop:
# Description:       Quick X Display Manager
### END INIT INFO

. /etc/rc.status
. /etc/sysconfig/displaymanager

check_nfs()
{
    # Check if important mount point is NFS mounted
    while read  where what type options rest  ; do
	test "$type" = "nfs" || continue
	case "$where" in
	\#*|"") ;;
	*)  case "$options" in
	    *noauto*) ;;
	    *)	case "$where" in
		/usr*|/opt*|/home*) return 1 ;;
		esac
	    esac
	esac
    done < /etc/fstab

    return 0 # False - default
}

check_remote_autologin()
{
   if test -n "$DISPLAYMANAGER_AUTOLOGIN"; then
      grep -q "^$DISPLAYMANAGER_AUTOLOGIN:" /etc/passwd || return 1
   fi
   return 0
}

check_kbd()
{
   test -s /var/run/keymap
   return
}

check_syslog()
{
   . /etc/sysconfig/syslog

   case "$SYSLOG_DAEMON" in
      syslog-ng)
         config=/etc/syslog-ng/syslog-ng.conf
        ;;
      *)
         config=/etc/syslog.conf
        ;;
   esac

   case "$SYSLOG_DAEMON" in
     syslog-ng)
        while read line ; do
            case "$line" in
                \#*|"") continue ;;
                *udp\ *|*udp\(*) return 1 ;;
                *tcp\ *|*tcp\(*) return 1 ;;
            esac
        done < ${config}
        ;;
     *)
        while read select action ; do
            case "$select" in \#*|"") continue ;; esac
            case "$action" in *@*)    return 1   ;; esac
        done < ${config}
        ;;
   esac

   return 0
}

check()
{
    check_nfs || return 1
    check_kbd || return 1
    check_syslog || return 1
    check_remote_autologin || return 1
    # ...
    return 0
}

# default
if test -z "$DISPLAYMANAGER" && test -x /opt/gnome/bin/gdm; then
   DISPLAYMANAGER=gdm
fi

case "$DISPLAYMANAGER" in
    gdm|gnome|GDM|GNOME) ;;
    *) exit 0;;
esac

case "$1" in
    start)
        if test -x /sbin/preload && test -f /etc/preload.d/gdm; then
            /sbin/preload /etc/preload.d/gdm
	    echo i!
        fi
        ;;
    *) ;;
esac
openSUSE Build Service is sponsored by