PREIN
/bin/sh
getent group dovecot >/dev/null || groupadd -r dovecot
getent passwd dovecot >/dev/null || \
useradd -r -g dovecot -d /usr/libexec/dovecot -s /sbin/nologin -c "Dovecot IMAP server" dovecot
exit 0
PREUN
/bin/sh
if [ $1 = 0 ]; then
/sbin/service dovecot stop > /dev/null 2>&1
/sbin/chkconfig --del dovecot
fi
POSTIN
/bin/sh
/sbin/chkconfig --add dovecot
# generate the ssl certificates
if [ ! -f /etc/pki/dovecot/certs/dovecot.pem ]; then
SSLDIR=/etc/pki/dovecot OPENSSLCONFIG=/etc/pki/dovecot/dovecot-openssl.cnf \
/usr/libexec/dovecot/mkcert.sh &> /dev/null
fi
if ! test -f /var/run/dovecot/login/ssl-parameters.dat; then
dovecot --build-ssl-parameters &>/dev/null
fi
exit 0
POSTUN
/bin/sh
if [ "$1" -ge "1" ]; then
/sbin/service dovecot condrestart >/dev/null 2>&1 || :
fi