summaryrefslogtreecommitdiff
path: root/mail/courier-auth/files/authdaemond.sh
blob: 42f4b4549c0965a233c19e8071032b0caba5de2c (plain)
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
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: authdaemond.sh,v 1.6 2002/09/20 02:01:56 grant Exp $
#
# Courier user authentication daemon
#
# PROVIDE: authdaemond
# REQUIRE: LOGIN

if [ -f /etc/rc.subr ]
then
        . /etc/rc.subr
fi

name="authdaemond"
rcvar=${name}
daemon="@PREFIX@/libexec/courier/authlib/authdaemond"
pidfile="/var/authdaemon/pid"
required_files="@PKG_SYSCONFDIR@/authdaemonrc"

start_cmd="courier_doit start"
stop_cmd="courier_doit stop"

# Read the authdaemond config file to determine the actual command
# executed.  If "$version" is non-empty, then it contains the
# command name, otherwise, use the default of "authdaemond.plain".
# We read the config file in a subprocess to protect against shell
# environment pollution.
#
if [ -f @PKG_SYSCONFDIR@/authdaemonrc ]
then
	command=`
		. @PKG_SYSCONFDIR@/authdaemonrc
		if [ -n "${version}" ]
		then
			@ECHO@ @PREFIX@/libexec/courier/authlib/${version}
		else
			@ECHO@ @PREFIX@/libexec/courier/authlib/authdaemond.plain
		fi
	`
fi

courier_doit()
{
        action=$1
        case ${action} in
        start)  echo "Starting ${name}." ;;
        stop)   echo "Stopping ${name}." ;;
        esac

        @SETENV@ -i ${daemon} ${action}
}

if [ -f /etc/rc.subr ]
then
        load_rc_config $name
        run_rc_command "$1"
else
        echo -n " ${name}"
        ${start_cmd}
fi