PREIN
/bin/sh
# Create 'cyrus' user on target host
/usr/sbin/useradd -c "Cyrus IMAP Server" -d /var/lib/imap -g mail \
-s /bin/bash -u 76 -r cyrus 2> /dev/null || :
PREUN
/bin/sh
if [ $1 = 0 ]; then
/sbin/service cyrus-imapd stop >/dev/null 2>&1 || :
/sbin/chkconfig --del cyrus-imapd
/usr/sbin/userdel cyrus 2> /dev/null || :
rm -f /var/lib/imap/socket/lmtp 2> /dev/null
fi
POSTIN
/bin/sh
/sbin/chkconfig --add cyrus-imapd
# Create SSL certificates
# XX not going to work on mandrake
#exec > /dev/null 2> /dev/null
#if [ ! -f /usr/share/ssl/certs/cyrus-imapd.pem ]; then
#pushd /usr/share/ssl/certs
#umask 077
#cat << EOF | make cyrus-imapd.pem
#--
#SomeState
#SomeCity
#SomeOrganization
#SomeOrganizationalUnit
#localhost.localdomain
#root@localhost.localdomain
#EOF
#chown root.mail cyrus-imapd.pem
#chmod 640 cyrus-imapd.pem
#popd
#fi
# Force synchronous updates only on ext2 filesystems
# Note: This will slow down user creation for 10.000+ users!
for i in /var/lib/imap/{user,quota} /var/spool/imap
do
if [ `find $i -maxdepth 0 -printf file.file` = "ext2" ]; then
chattr -R +S $i 2>/dev/null
fi
done
# Add sieve service if necessary
if ! grep -q ^sieve /etc/services; then
echo -e 'sieve\t\t2000/tcp\t\t\t# Sieve mail filter daemon' >> /etc/services
fi
# Add lmtp service if necessary
if ! grep -q ^lmtp /etc/services; then
echo -e 'lmtp\t\t2003/tcp\t\t\t# Local mail delivery protocol (rfc2033)' >> /etc/services
fi
POSTUN
/bin/sh
if [ $1 -ge 1 ]; then
/sbin/service cyrus-imapd condrestart >/dev/null 2>&1 || :
fi
Triggers
cyrus-imapd <
2.0.0
/bin/sh
#To avoid automatic restart of the daemon when upgrading from versions
#1.x.x of Cyrus IMAPd in rpm form, be sure the old daemon is stopped
/sbin/service cyrus-imapd stop >/dev/null 2>&1 || :