summaryrefslogtreecommitdiff
path: root/mail/dovecot/files
diff options
context:
space:
mode:
Diffstat (limited to 'mail/dovecot/files')
-rw-r--r--mail/dovecot/files/dovecot.sh.in42
-rw-r--r--mail/dovecot/files/patch-dovecot-example.conf42
-rw-r--r--mail/dovecot/files/pkg-deinstall.in16
-rw-r--r--mail/dovecot/files/pkg-install.in11
4 files changed, 55 insertions, 56 deletions
diff --git a/mail/dovecot/files/dovecot.sh.in b/mail/dovecot/files/dovecot.sh.in
index 57a8dabd5f4a..edf7033e0ab0 100644
--- a/mail/dovecot/files/dovecot.sh.in
+++ b/mail/dovecot/files/dovecot.sh.in
@@ -7,34 +7,44 @@
# REQUIRE: %%REQUIRE%%
# KEYWORD: shutdown
-# Define these dovecot_* variables in one of these files:
+# Define dovecot_* variables in one of these files:
# /etc/rc.conf
# /etc/rc.conf.local
# /etc/rc.conf.d/dovecot
-#
-# DO NOT CHANGE THESE DEFAULT VALUES HERE
-#
-: ${dovecot_enable:="NO"}
. %%RC_SUBR%%
name=dovecot
rcvar=`set_rcvar`
-command=%%PREFIX%%/sbin/${name}
-required_files=%%PREFIX%%/etc/${name}.conf
-start_precmd="${name}_prestart"
+# read configuration and set defaults
+load_rc_config ${name}
+: ${dovecot_enable:="NO"}
+
+command="%%PREFIX%%/sbin/${name}"
+command_args="-c ${dovecot_config:="%%PREFIX%%/etc/${name}.conf"}"
+required_files="${dovecot_config}"
+start_precmd="start_precmd"
+stop_postcmd="stop_postcmd"
extra_commands="restart"
-dovecot_prestart()
+base_dir=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^base_dir:/ { print $2 }')
+login_dir=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^login_dir:/ { print $2 }')
+login_user=$(${command} ${command_args} -a | /usr/bin/awk -F ': ' '/^login_user:/ { print $2 }')
+
+pidfile="${base_dir}/master.pid"
+
+start_precmd()
{ # Ensure runtime directories exist with correct permissions
- local base user gid
- base=/var/run/${name}
- user=$(/usr/bin/awk -F '[[:space:]]*=[[:space:]]*' '/^[[:space:]]*login_user[[:space:]]*=/ { print $2 }' ${required_files})
- gid=$(/usr/sbin/pw usershow -n "${user:-${name}}" 2>/dev/null | /usr/bin/cut -d: -f4)
- /usr/bin/install -o root -g wheel -m 0755 -d ${base}
- /usr/bin/install -o root -g ${gid} -m 0750 -d ${base}/login
+ local gid
+ gid=$(/usr/sbin/pw usershow -n "${login_user}" 2>/dev/null | /usr/bin/cut -d: -f4)
+ /usr/bin/install -o root -g wheel -m 0755 -d ${base_dir}
+ /usr/bin/install -o root -g ${gid} -m 0750 -d ${login_dir}
+}
+
+stop_postcmd()
+{ # Cleanup runtime directories
+ rm -rf ${base_dir} 2>/dev/null
}
-load_rc_config ${name}
run_rc_command "$1"
diff --git a/mail/dovecot/files/patch-dovecot-example.conf b/mail/dovecot/files/patch-dovecot-example.conf
index ec434b3af8ec..d6f4519ee045 100644
--- a/mail/dovecot/files/patch-dovecot-example.conf
+++ b/mail/dovecot/files/patch-dovecot-example.conf
@@ -1,5 +1,5 @@
---- dovecot-example.conf.orig 2008-10-26 11:00:45.000000000 -0400
-+++ dovecot-example.conf 2008-10-26 11:00:45.000000000 -0400
+--- dovecot-example.conf.orig 2008-11-23 16:53:53.000000000 -0500
++++ dovecot-example.conf 2008-11-23 16:53:53.000000000 -0500
@@ -20,7 +20,7 @@
# Protocols we want to be serving: imap imaps pop3 pop3s
@@ -18,7 +18,7 @@
# Should all IMAP and POP3 processes be killed when Dovecot master process
# shuts down. Setting this to "no" means that Dovecot can be upgraded without
-@@ -211,7 +211,7 @@
+@@ -213,7 +213,7 @@
#
# <doc/wiki/MailLocation.txt>
#
@@ -27,7 +27,7 @@
# If you need to set multiple mailbox locations or want to change default
# namespace settings, you can do it by defining namespace sections.
-@@ -271,7 +271,7 @@
+@@ -273,7 +273,7 @@
# Group to enable temporarily for privileged operations. Currently this is
# used only with INBOX when either its initial creation or dotlocking fails.
# Typically this is set to "mail" to give access to /var/mail.
@@ -36,7 +36,7 @@
# Grant access to these supplementary groups for mail processes. Typically
# these are used to set up access to shared mailboxes. Note that it may be
-@@ -310,7 +310,7 @@
+@@ -312,7 +312,7 @@
# Rely on O_EXCL to work when creating dotlock files. NFS supports O_EXCL
# since version 3, so this should be safe to use nowadays by default.
@@ -45,7 +45,7 @@
# Don't use fsync() or fdatasync() calls. This makes the performance better
# at the cost of potential data loss if the server (or the file server)
-@@ -338,20 +338,20 @@
+@@ -340,20 +340,20 @@
# Show more verbose process titles (in ps). Currently shows user name and
# IP address. Useful for seeing who are actually using the IMAP processes
# (eg. shared mailboxes or if same uid is used for multiple accounts).
@@ -69,7 +69,7 @@
#last_valid_gid = 0
# Maximum number of running mail processes. When this limit is reached,
-@@ -418,7 +418,7 @@
+@@ -420,7 +420,7 @@
# When copying a message, do it with hard links whenever possible. This makes
# the performance much better, and it's unlikely to have any side effects.
@@ -78,7 +78,7 @@
# When copying a message, try to preserve the base filename. Only if the
# destination mailbox already contains the same name (ie. the mail is being
-@@ -533,7 +533,7 @@
+@@ -535,7 +535,7 @@
# Send IMAP capabilities in greeting message. This makes it unnecessary for
# clients to request it with CAPABILITY command, so it saves one round-trip.
# Many clients however don't understand it and ask the CAPABILITY anyway.
@@ -87,7 +87,7 @@
# IMAP logout format string:
# %i - total number of bytes read from client
-@@ -562,7 +562,7 @@
+@@ -564,7 +564,7 @@
# but not both. Thunderbird separates these two by forcing server to
# accept '/' suffix in mailbox names in subscriptions list.
# The list is space-separated.
@@ -96,7 +96,7 @@
}
##
-@@ -614,7 +614,7 @@
+@@ -616,7 +616,7 @@
# Dovecot's default, so if you're building a new server it would be a good
# idea to change this. %08Xu%08Xv should be pretty fail-safe.
#
@@ -105,7 +105,7 @@
# POP3 logout format string:
# %i - total number of bytes read from client
-@@ -645,7 +645,7 @@
+@@ -647,7 +647,7 @@
# Outlook Express and Netscape Mail breaks if end of headers-line is
# missing. This option simply sends it if it's missing.
# The list is space-separated.
@@ -114,7 +114,7 @@
}
##
-@@ -736,7 +736,7 @@
+@@ -738,7 +738,7 @@
# the standard variables here, eg. %Lu would lowercase the username, %n would
# drop away the domain if it was given, or "%n-AT-%d" would change the '@' into
# "-AT-". This translation is done after auth_username_translation changes.
@@ -123,7 +123,7 @@
# If you want to allow master users to log in by specifying the master
# username within the normal username string (ie. not using SASL mechanism's
-@@ -792,7 +792,7 @@
+@@ -794,7 +794,7 @@
# plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey
# gss-spnego
# NOTE: See also disable_plaintext_auth setting.
@@ -132,7 +132,7 @@
#
# Password database is used to verify user's password (and nothing more).
-@@ -854,6 +854,7 @@
+@@ -856,6 +856,7 @@
# args = session=yes %Ls
# args = cache_key=%u dovecot
#args = dovecot
@@ -140,7 +140,7 @@
}
# System users (NSS, /etc/passwd, or similiar)
-@@ -897,14 +898,16 @@
+@@ -899,14 +900,16 @@
# SQL database <doc/wiki/AuthDatabase.SQL.txt>
#passdb sql {
@@ -161,7 +161,7 @@
#}
# vpopmail authentication <doc/wiki/AuthDatabase.VPopMail.txt>
-@@ -931,7 +934,7 @@
+@@ -933,7 +936,7 @@
# proceses. Useful with remote NSS lookups that may block.
# NOTE: Be sure to use this setting with nss_ldap or users might get
# logged in as each others!
@@ -170,7 +170,7 @@
}
# passwd-like file with specified location
-@@ -960,14 +963,16 @@
+@@ -962,14 +965,16 @@
# SQL database <doc/wiki/AuthDatabase.SQL.txt>
#userdb sql {
@@ -191,7 +191,7 @@
#}
# vpopmail <doc/wiki/AuthDatabase.VPopMail.txt>
-@@ -1007,25 +1012,25 @@
+@@ -1009,25 +1014,25 @@
#ssl_username_from_cert = no
# It's possible to export the authentication interface to other programs:
@@ -227,7 +227,7 @@
}
# If you wish to use another authentication server than dovecot-auth, you can
-@@ -1055,8 +1060,9 @@
+@@ -1057,8 +1062,9 @@
#quota = mysql:/etc/dovecot-dict-quota.conf
}
@@ -239,7 +239,7 @@
##
## Plugin settings
-@@ -1093,8 +1099,8 @@
+@@ -1095,8 +1101,8 @@
# Each quota root has separate limits. Only the command for the first
# exceeded limit is excecuted, so put the highest limit first.
# Note that % needs to be escaped as %%, otherwise "% " expands to empty.
@@ -250,7 +250,7 @@
#quota = maildir
# ACL plugin. vfile backend reads ACLs from "dovecot-acl" file from maildir
-@@ -1131,7 +1137,7 @@
+@@ -1133,7 +1139,7 @@
# you must set up:
# dovecot --exec-mail ext /usr/libexec/dovecot/expire-tool
#expire = Trash 7 Spam 30
diff --git a/mail/dovecot/files/pkg-deinstall.in b/mail/dovecot/files/pkg-deinstall.in
index 30ae84752a39..d4192f7efbed 100644
--- a/mail/dovecot/files/pkg-deinstall.in
+++ b/mail/dovecot/files/pkg-deinstall.in
@@ -1,8 +1,9 @@
#! /bin/sh
#
-# $FreeBSD: /tmp/pcvs/ports/mail/dovecot/files/pkg-deinstall.in,v 1.1 2008-09-08 06:42:28 beech Exp $
+# $FreeBSD: /tmp/pcvs/ports/mail/dovecot/files/pkg-deinstall.in,v 1.2 2008-11-28 14:38:26 wxs Exp $
#
-# ex:ts=4
+
+PKG_PREFIX=${PKG_PREFIX:=/usr/local}
ask() {
local question default answer
@@ -48,7 +49,7 @@ case $2 in
DEINSTALL)
if ps -axc | grep -qw dovecot; then
if yesno "Dovecot is still running. Shall I stop it?" y; then
- killall dovecot
+ ${PKG_PREFIX}/etc/rc.d/dovecot stop
sleep 2
else
echo "OK ... I hope you know what you are doing."
@@ -57,14 +58,7 @@ DEINSTALL)
delete_account Dovecot dovecot:${DOVECOT_UID:-%%DOVECOT_UID%%} dovecot:${DOVECOT_GID:-%%DOVECOT_GID%%}
- echo "Also manually rm -rf /var/db/dovecot if anything was stored there."
-
- base=/var/run/dovecot
- DIRLIST="${base}/login ${base}"
- echo "Cleaning up \"${base}\"."
- for directory in ${DIRLIST}; do
- rmdir ${directory} 2>/dev/null || :
- done
+ echo "Also manually 'rm -rf /var/db/dovecot' if anything was stored there."
;;
esac
diff --git a/mail/dovecot/files/pkg-install.in b/mail/dovecot/files/pkg-install.in
index 93faa0f3e36f..d1b52d5d8941 100644
--- a/mail/dovecot/files/pkg-install.in
+++ b/mail/dovecot/files/pkg-install.in
@@ -1,8 +1,9 @@
#!/bin/sh
#
-# $FreeBSD: /tmp/pcvs/ports/mail/dovecot/files/pkg-install.in,v 1.1 2008-09-08 06:42:28 beech Exp $
+# $FreeBSD: /tmp/pcvs/ports/mail/dovecot/files/pkg-install.in,v 1.2 2008-11-28 14:38:26 wxs Exp $
#
-# ex:ts=4
+
+PKG_PREFIX=${PKG_PREFIX:=/usr/local}
ask() {
local question default answer
@@ -88,10 +89,4 @@ PRE-INSTALL)
create_account Dovecot dovecot:${DOVECOT_UID:-%%DOVECOT_UID%%} dovecot:${DOVECOT_GID:-%%DOVECOT_GID%%} "Dovecot User" /var/empty /usr/sbin/nologin
;;
-POST-INSTALL)
- base=/var/run/dovecot
- /usr/bin/install -o root -g wheel -m 0755 -d ${base}
- /usr/bin/install -o root -g dovecot -m 0750 -d ${base}/login
- ;;
-
esac