Sophie

Sophie

distrib > CentOS > 5 > x86_64 > by-pkgid > e7bfab6304dc87968e5bd6dbfedf9d70 > scriptlet

cyrus-imapd-utils-2.3.7-12.el5_7.2.x86_64.rpm

PREIN

/bin/sh
# Create 'cyrus' user on target host
/usr/sbin/groupadd -g 76 -r saslauth 2> /dev/null || :
/usr/sbin/useradd -c "Cyrus IMAP Server" -d /var/lib/imap -g mail \
  -G saslauth -s /bin/bash -u 76 -r cyrus 2> /dev/null || :

POSTIN

/bin/sh
# Create SSL certificates
exec > /dev/null 2> /dev/null
# if the certificate is only in the old location, move it to the new location
if [ -f /usr/share/ssl/certs/cyrus-imapd.pem -a ! -f /etc/pki/cyrus-imapd/cyrus-imapd.pem ]; then
mv /usr/share/ssl/certs/cyrus-imapd.pem /etc/pki/cyrus-imapd/cyrus-imapd.pem
fi
if [ ! -f /etc/pki/cyrus-imapd/cyrus-imapd.pem ]; then
pushd /etc/pki/tls/certs
umask 077
/bin/cat << EOF | make cyrus-imapd.pem
--
SomeState
SomeCity
SomeOrganization
SomeOrganizationalUnit
localhost.localdomain
root@localhost.localdomain
EOF
/bin/chown root.mail cyrus-imapd.pem
/bin/chmod 640 cyrus-imapd.pem
mv cyrus-imapd.pem /etc/pki/cyrus-imapd/cyrus-imapd.pem
popd
fi

# Add service entries if necessary
if ! /bin/grep -q ^lmtp /etc/services; then
  echo -e 'lmtp\t\t24/tcp\t\t\t\t# LMTP Mail Delivery over TCP' >> /etc/services
  echo -e 'lmtp\t\t24/udp\t\t\t\t# LMTP Mail Delivery over TCP' >> /etc/services
fi
if ! /bin/grep -q ^nntps /etc/services; then
  echo -e 'nntps\t\t563/tcp\t\t\t\t# NNTP over SSL' >> /etc/services
  echo -e 'nntps\t\t563/udp\t\t\t\t# NNTP over SSL' >> /etc/services
fi
if ! /bin/grep -q ^pop3s /etc/services; then
  echo -e 'pop3s\t\t995/tcp\t\t\t\t# POP-3 over SSL' >> /etc/services
  echo -e 'pop3s\t\t995/udp\t\t\t\t# POP-3 over SSL' >> /etc/services
fi
if ! /bin/grep -q ^imaps /etc/services; then
  echo -e 'imaps\t\t993/tcp\t\t\t\t# IMAP over SSL' >> /etc/services
  echo -e 'imaps\t\t993/udp\t\t\t\t# IMAP over SSL' >> /etc/services
fi
if ! /bin/grep -q ^sieve /etc/services; then
  echo -e 'sieve\t\t2000/tcp\t\t\t# Sieve Mail Filter Daemon' >> /etc/services
  echo -e 'sieve\t\t2000/udp\t\t\t# Sieve Mail Filter Daemon' >> /etc/services
fi
if ! /bin/grep -q ^csync /etc/services; then
  echo -e 'csync\t\t2005/tcp\t\t\t# Cyrus IMAP Replication Daemon' >> /etc/services
  echo -e 'csync\t\t2005/udp\t\t\t# Cyrus IMAP Replication Daemon' >> /etc/services
fi
if ! /bin/grep -q ^mupdate /etc/services; then
  echo -e 'mupdate\t\t3905/tcp\t\t\t# Cyrus IMAP Mupdate Daemon' >> /etc/services
  echo -e 'mupdate\t\t3905/udp\t\t\t# Cyrus IMAP Mupdate Daemon' >> /etc/services
fi
if ! /bin/grep -q ^fud /etc/services; then
  echo -e 'fud\t\t4201/udp\t\t\t# Cyrus IMAP FUD Daemon' >> /etc/services
fi

POSTUN

/bin/sh
if [ $1 = 0 ]; then
  /usr/sbin/userdel cyrus 2> /dev/null || :
  if [ "$(/bin/grep ^saslauth: /etc/group | cut -d: -f4-)" = "" ]; then
    /usr/sbin/groupdel saslauth 2> /dev/null || :
  fi
fi