PREIN
/bin/sh
if [ $1 == 1 ]; then
# Create 'cyrus' user on target host
/usr/sbin/groupadd -r saslauth 2> /dev/null || :
/usr/sbin/useradd -c "Cyrus IMAP Server" -d /var/lib/imap -g mail \
-G saslauth -s /sbin/nologin -r cyrus 2> /dev/null || :
fi
## From documentation:
# It is strongly recommended to shut down the Cyrus IMAP services
# before performing the upgrade, as the newer binaries will end up
# writing to mailboxes.db in a way that is not compatible with the older binaries
# (that would otherwise still be running).
if [ $1 == 2 ]; then
/usr/bin/systemctl stop cyrus-imapd
fi
PREUN
/bin/sh
/usr/share/rpm-helper/del-service cyrus-imapd $1 cyrus-imapd
POSTIN
/bin/sh
CHATTRSYNC=0
if [ -f "/etc/sysconfig/cyrus-imapd" ]; then
source /etc/sysconfig/cyrus-imapd
fi
if [ $CHATTRSYNC -eq 1 ]; then
# Force synchronous updates of files in the following directories
chattr -R +S \
$(grep ^configdirectory: /etc/imapd.conf | cut -d':' -f2) \
$(grep ^partition- /etc/imapd.conf | cut -d':' -f2) \
$(grep ^metapartition- /etc/imapd.conf | cut -d':' -f2) 2>/dev/null ||:
fi
# Create SSL certificates
/usr/share/rpm-helper/create-ssl-certificate cyrus-imapd $1 cyrus-imapd
chown cyrus:mail /etc/pki/tls/private/cyrus-imapd.pem
# These commands may fail in a docker container, which may not
# have a /usr/bin/systemctl with a 'preset' command
/usr/share/rpm-helper/add-service cyrus-imapd $1 cyrus-imapd