diff options
author | jlam <jlam> | 2002-07-31 15:48:31 +0000 |
---|---|---|
committer | jlam <jlam> | 2002-07-31 15:48:31 +0000 |
commit | a3794159c1d88ad897f73245a99176d76cab0db7 (patch) | |
tree | f4660b86b9ae87ea594854a67a3eba86eb1e503b /mail/cyrus-imapd | |
parent | ecd059a0cfcc5a7ba7aac4240db354c2de4b33ee (diff) | |
download | pkgsrc-a3794159c1d88ad897f73245a99176d76cab0db7.tar.gz |
Add a cyrus rc.d script that will generate the directories needed before
starting the Cyrus master process.
Diffstat (limited to 'mail/cyrus-imapd')
-rw-r--r-- | mail/cyrus-imapd/Makefile | 15 | ||||
-rw-r--r-- | mail/cyrus-imapd/PLIST | 3 | ||||
-rw-r--r-- | mail/cyrus-imapd/files/cyrus.sh | 78 |
3 files changed, 94 insertions, 2 deletions
diff --git a/mail/cyrus-imapd/Makefile b/mail/cyrus-imapd/Makefile index 59df72538f9..9ee4a973c29 100644 --- a/mail/cyrus-imapd/Makefile +++ b/mail/cyrus-imapd/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.28 2002/07/30 18:22:03 jlam Exp $ +# $NetBSD: Makefile,v 1.29 2002/07/31 15:48:31 jlam Exp $ DISTNAME= cyrus-imapd-2.0.16 PKGREVISION= 1 @@ -28,6 +28,8 @@ CYRUS_USER?= cyrus CYRUS_GROUP?= mail BUILD_DEFS+= CYRUS_USER CYRUS_GROUP +FILES_SUBST+= CYRUS_USER=${CYRUS_USER} +FILES_SUBST+= CYRUS_GROUP=${CYRUS_GROUP} CONFIGURE_ARGS+= --with-cyrus-user=${CYRUS_USER} CONFIGURE_ARGS+= --with-cyrus-group=${CYRUS_GROUP} @@ -65,6 +67,7 @@ HTMLDIR= ${PREFIX}/share/doc/html/cyrus-imapd EGDIR= ${PREFIX}/share/examples/cyrus-imapd CONF_FILES= ${EGDIR}/imapd.conf ${PKG_SYSCONFDIR}/imapd.conf CONF_FILES+= ${EGDIR}/normal.conf ${PKG_SYSCONFDIR}/cyrus.conf +RCD_SCRIPTS= cyrus FILES_SUBST+= IMAPDCONF=${PKG_SYSCONFDIR}/imapd.conf DEINSTALL_EXTRA_TMPL= ${PKGDIR}/DEINSTALL @@ -98,7 +101,17 @@ post-patch: ${MV} -f $${file}.fixed $${file}; \ done +pre-install: + @for script in ${RCD_SCRIPTS}; do \ + ${SED} ${FILES_SUBST_SED} ${FILESDIR}/$${script}.sh \ + > ${WRKDIR}/$${script}; \ + done + post-install: + for script in ${RCD_SCRIPTS}; do \ + ${INSTALL_SCRIPT} ${WRKDIR}/$${script} \ + ${PREFIX}/etc/rc.d/$${script}; \ + done ${INSTALL_SCRIPT} ${WRKSRC}/tools/mkimap ${PREFIX}/cyrus/bin ${INSTALL_DATA_DIR} ${EGDIR} ${INSTALL_DATA} ${FILESDIR}/imapd.conf ${EGDIR} diff --git a/mail/cyrus-imapd/PLIST b/mail/cyrus-imapd/PLIST index 4e2e82a5c4f..248a946e976 100644 --- a/mail/cyrus-imapd/PLIST +++ b/mail/cyrus-imapd/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.2 2001/11/21 22:12:24 wiz Exp $ +@comment $NetBSD: PLIST,v 1.3 2002/07/31 15:48:31 jlam Exp $ bin/imtest bin/installsieve bin/sieveshell @@ -18,6 +18,7 @@ cyrus/bin/pop3d cyrus/bin/quota cyrus/bin/reconstruct cyrus/bin/timsieved +etc/rc.d/cyrus include/cyrus/acap.h include/cyrus/acl.h include/cyrus/assert.h diff --git a/mail/cyrus-imapd/files/cyrus.sh b/mail/cyrus-imapd/files/cyrus.sh new file mode 100644 index 00000000000..1f22318315b --- /dev/null +++ b/mail/cyrus-imapd/files/cyrus.sh @@ -0,0 +1,78 @@ +#!/bin/sh +# +# $NetBSD: cyrus.sh,v 1.1 2002/07/31 15:48:32 jlam Exp $ +# +# PROVIDE: cyrus +# REQUIRE: DAEMON +# +# 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="& sleep 2" +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 + imap_dirs=` + @AWK@ '/^configdirectory:/ { print $2 }; \ + /^partition-.*:/ { print $2 }; \ + /^sievedir:/ { print $2 }' \ + @IMAPDCONF@ \ + ` + for dir in ${imap_dirs}; 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 |