PREIN
/bin/sh
# Let postun know whether cyrus-imapd was running
if [ -e /var/lock/subsys/cyrus-imapd ]; then
/sbin/service cyrus-imapd stop >/dev/null 2>&1 || :
touch /var/lock/subsys/cyrus-imapd
fi
PREUN
/bin/sh
if [ $1 = 0 ]; then
/sbin/service cyrus-imapd stop >/dev/null 2>&1 || :
/sbin/chkconfig --del cyrus-imapd
/bin/rm -f /var/lib/imap/socket/* 2> /dev/null
/bin/rm -f /var/lib/imap/proc/* 2> /dev/null
/bin/rm -f /var/lib/imap/ptclient/ptsock 2> /dev/null
fi
POSTIN
/bin/sh
/sbin/chkconfig --add cyrus-imapd
# Force synchronous updates, usually only on ext2 filesystems
for i in /var/lib/imap/{user,quota} /var/spool/imap
do
if [ $(find $i -maxdepth 0 -printf %F) = "ext2" ]; then
chattr -R +S $i 2>/dev/null
fi
done
# "ctl_deliver -E" is deprecated, now is "cyr_expire -E"
if grep -q "ctl_deliver *-E" /etc/cyrus.conf ; then
/usr/bin/perl -pi -e "s/ctl_deliver *-E/cyr_expire -E/" /etc/cyrus.conf
fi
# prevent idled related errors to show up
if grep -q "^# idled" /etc/cyrus.conf ; then
/usr/bin/perl -pi -e "s/^# idled/ idled/" /etc/cyrus.conf
fi
# change existing config so ssl certificates are under /etc rather than /usr/share
if grep -q '/usr/share/ssl/certs/cyrus-imapd.pem' /etc/imapd.conf; then
sed 's@/usr/share/ssl/certs/cyrus-imapd.pem@/etc/pki/cyrus-imapd/cyrus-imapd.pem@g' /etc/imapd.conf
fi
if grep -q '/usr/share/ssl/certs/ca-bundle.crt' /etc/imapd.conf; then
sed 's@/usr/share/ssl/certs/ca-bundle.crt@/etc/pki/tls/certs/ca-bundle.crt@' /etc/imapd.conf
fi
POSTUN
/bin/sh
if [ $1 != 0 ]; then
/sbin/service cyrus-imapd condrestart >/dev/null 2>&1 || :
fi