blob: 95aa628da13287afd5973c4ef00eeced9e15a95f (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: cyrus.sh,v 1.3 2004/08/11 20:52:24 jlam Exp $
#
# PROVIDE: cyrus
# REQUIRE: DAEMON
# BEFORE: mail
#
# To start cyrus-imapd at startup, copy this script to /etc/rc.d and set
# cyrus=YES in /etc/rc.conf.
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
rcd_dir=`@DIRNAME@ $0`
name="cyrus"
rcvar=$name
command="@PREFIX@/cyrus/bin/master"
command_args="-d"
pidfile="/var/run/cyrus-master.pid"
required_files="@PKG_SYSCONFDIR@/cyrus.conf @IMAPDCONF@"
extra_commands="mkimap reload"
mkimap_cmd="cyrus_mkimap"
start_precmd="cyrus_prestart"
cyrus_prestart()
{
# Check to see if "configdirectory" is present before we start
# the Cyrus IMAP server. Otherwise, we run mkimap to generate
# the necessary directories.
#
if [ -f @IMAPDCONF@ ]; then
configdir=` \
@AWK@ '/^configdirectory:/ { print $2; exit };' \
@IMAPDCONF@ \
`
if [ -z "$configdir" ]; then
@ECHO@ "@IMAPDCONF@ missing 'configdirectory' setting"
exit 1
fi
if [ ! -d "$configdir" ]; then
$rcd_dir/cyrus mkimap
fi
fi
}
cyrus_mkimap()
{
# Generate the prerequisite directory structure for Cyrus IMAP.
if [ -f @IMAPDCONF@ ]; then
@AWK@ '/^configdirectory:/ { print $2 }; \
/^partition-.*:/ { print $2 }; \
/^sievedir:/ { print $2 }' \
@IMAPDCONF@ | \
while read dir; do
if [ ! -d "$dir" ]; then
@MKDIR@ "$dir"
@CHMOD@ 750 "$dir"
@CHOWN@ @CYRUS_USER@ "$dir"
@CHGRP@ @CYRUS_GROUP@ "$dir"
fi
done
@SU@ -m @CYRUS_USER@ -c "@PREFIX@/cyrus/bin/mkimap"
fi
}
if [ -f /etc/rc.subr -a -f /etc/rc.conf \
-a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
load_rc_config $name
run_rc_command "$1"
else
@ECHO@ -n " ${name}"
eval ${start_precmd}
${command} ${cyrus_flags} ${command_args}
fi
|