aboutsummaryrefslogtreecommitdiffstats
path: root/x11/gdm/files/gdm.in
blob: bdc726d08d8837bcf9e6d9afd126c1e3ac2d3fb7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh

# $FreeBSD$
#    $MCom: ports-stable/x11/gdm/files/gdm.in,v 1.5 2010/07/21 13:50:46 kwm Exp $
#
# PROVIDE: gdm
# REQUIRE: LOGIN cleanvar moused syscons dbus
#
# Add the following to /etc/rc.conf to start GDM at boot time:
#
# gdm_enable="YES"

. /etc/rc.subr
. %%GNOME_SUBR%%

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:%%LOCALBASE%%/bin:%%LOCALBASE%%/sbin

name="gdm"
rcvar=gdm_enable

load_rc_config ${name}

gnome_enable=${gnome_enable:-NO}
gdm_enable=${gdm_enable-${gnome_enable}}
gdm_preserve_base_pam_conf=${gdm_preserve_base_pam_conf-NO}
gdm_lang=${gdm_lang-${LANG}}

command="%%PREFIX%%/sbin/${name}"
pidfile="/var/run/${name}.pid"
procname="%%PREFIX%%/sbin/gdm-binary"
start_cmd="gdm_start"

gdm_start()
{
    local iter

    echo "Starting ${name}."

    # make sure there is no pam configuration for gdm service in base system
    if ! checkyesno gdm_preserve_base_pam_conf && [ -f /etc/pam.d/gdm ]; then
    cp -p /etc/pam.d/gdm /etc/pam.d/gdm_disabled
    unlink /etc/pam.d/gdm
    fi

    ( iter=0
    while ! ps -axoargs | grep "^/usr/libexec/getty " | grep -qv grep >/dev/null 2>&1; do
    if [ ${iter} -eq 60 ]; then
        break
    fi
    sleep 1
    iter=$(expr ${iter} + 1)
    done
    iter=0
    while ! %%LOCALBASE%%/bin/lshal >/dev/null 2>&1 ; do
    if [ ! -x %%LOCALBASE%%/bin/lshal ]; then
        err 1 "%%LOCALBASE%%/bin/lshal is not installed"
    fi
    if [ ${iter} -eq 60 ]; then
        break
    fi
    sleep 1
    iter=$(expr ${iter} + 1)
    done
    LANG=${gdm_lang} ${command} ${gdm_flags} ) &
}

run_rc_command "$1"