#!/bin/sh

##
# Startup the GNOME Display Manager
##

. /etc/rc.common


StartService ()
{
    local SafeBoot=""
    local reply=$(ConsoleMessage -q SafeBoot)
    if [ "${reply:=-NO-}" = "-YES-" ]; then
        SafeBoot="-x"
    fi

    export XDG_DATA_DIRS=__PREFIX__/share

    if [ "${DISPLAYSERVER:=-QUARTZ-}" = "-X11-" ] &&
	[ "${SafeBoot:=-NO-}" = "-NO-" ]; then
	__PREFIX__/bin/gdm
    fi
}

StopService ()
{
    if [ "${DISPLAYSERVER:=-QUARTZ-}" = "-X11-" ]; then
	__PREFIX__/sbin/gdm-stop
    fi
}

RestartService () {
    if [ "${DISPLAYSERVER:=-QUARTZ-}" = "-X11-" ] &&
	[ "${SafeBoot:=-NO-}" = "-NO-" ]; then
	export XDG_DATA_DIRS=__PREFIX__/share
        __PREFIX__/sbin/gdm-restart
    fi
}


RunService "$1"