#!/bin/bash # $Header: /root/magellan-cvs/src/xorg/xdm.rc,v 1.2 2006-02-19 15:04:15 niro Exp $ #%rlevels: 5:s 0:k 1:k 2:k 3:k 4:k 6:k #%start: 95 #%stop: 05 #deps #%needs: #%before: #%after: source /etc/sysconfig/rc source $rc_functions source /etc/rc.config source /etc/profile if [ -z ${GLOGIN} ] then echo "You have to declare \"GLOGIN\" in /etc/rc.conf !" exit 1 fi XDM_OPT=$1 get_login() { case "$GLOGIN" in kdm|KDM) GLOGINCMD="$(which kdm 2> /dev/null)" if [ ! -f "${GLOGINCMD}" ] then echo "Failure: KDE Login Manager not found." exit 1 fi ;; gdm|GDM) if [[ ${XDM_OPT} = stop ]] then GLOGINCMD="$(which gdm-binary 2> /dev/null)" else GLOGINCMD="$(which gdm 2> /dev/null)" fi if [ ! -f "${GLOGINCMD}" ] then echo "Failure: GNOME Login Manager not found." exit 1 fi ;; entrance*|ENTRANCE*) GLOGINCMD="$(which entranced 2> /dev/null)" if [ ! -f "${GLOGINCMD}" ] then echo "Failure: Enlightenment Login Manager not found." exit 1 fi ;; wdm|WDM) GLOGINCMD="$(which wdm 2> /dev/null)" if [ ! -f "${GLOGINCMD}" ] then echo "Failure: Windowmaker Login Manager not found." exit 1 fi ;; xdm|XDM) GLOGINCMD="$(which xdm 2> /dev/null)" if [ ! -f "${GLOGINCMD}" ] then echo "Failure: XDM Login Manager not found." exit 1 fi ;; *) GLOGINCMD="$(which ${GLOGIN} 2> /dev/null)" if [ ! -f "${GLOGINCMD}" ] then echo "Failure: \"${GLOGIN}\" Login Manager not found." exit 1 fi ;; esac } case "${XDM_OPT}" in start) get_login echo -e ${COLOREDSTAR}"Starting ${GLOGIN} ..." /sbin/telinit a evaluate_retval update_svcstatus $1 splash svc_started "$(basename $0)" 0 ;; stop) get_login if [ -n "$(ps -A|grep $(basename ${GLOGINCMD}))" ] then echo -e ${COLOREDSTAR}"Stopping ${GLOGIN} ..." CUR_VT=$(fgconsole) start-stop-daemon --stop --quiet --exe ${GLOGINCMD} evaluate_retval chvt ${CUR_VT} fi update_svcstatus $1 splash svc_stopped "$(basename $0)" 0 ;; restart) $0 stop sleep 1 $0 start ;; status) get_login statusproc ${GLOGINCMD} ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 ;; esac