Sophie

Sophie

distrib > Scientific%20Linux > 5x > i386 > by-pkgid > 15301b1d0e4c8b5bbbeb269dd42fdff0 > scriptlet

dovecot-1.0.7-8.el5_9.1.i386.rpm

PREIN

/bin/sh
/usr/sbin/useradd -c "dovecot" -u 97 -s /sbin/nologin -r -d /usr/libexec/dovecot dovecot 2>/dev/null || :

# stop service during installation, keep flag if it was running to restart later
rm -f /var/run/dovecot-restart-after-rpm-install
/sbin/service dovecot status >/dev/null 2>&1
if [ $? -eq 0 ]; then
    touch /var/run/dovecot-restart-after-rpm-install
    /sbin/service dovecot stop >/dev/null 2>&1
fi

PREUN

/bin/sh
if [ $1 = 0 ]; then
 /usr/sbin/userdel dovecot 2>/dev/null || :
 /usr/sbin/groupdel dovecot 2>/dev/null || :
 [ -f /var/lock/subsys/dovecot ] && /sbin/service dovecot stop > /dev/null 2>&1
 /sbin/chkconfig --del dovecot
fi

POSTIN

/bin/sh
/sbin/chkconfig --add dovecot
# create a ssl cert
if [ -f /etc/pki/dovecot/dovecot.pem -a ! -e /etc/pki/dovecot/certs/dovecot.pem ]; then
    mv  /etc/pki/dovecot/dovecot.pem /etc/pki/dovecot/certs/dovecot.pem
else
    if [ -f /usr/share/ssl/certs/dovecot.pem -a ! -e /etc/pki/dovecot/certs/dovecot.pem ]; then
        mv /usr/share/ssl/certs/dovecot.pem /etc/pki/dovecot/certs/dovecot.pem
    fi
    if [ -f /usr/share/ssl/private/dovecot.pem -a ! -e /etc/pki/dovecot/private/dovecot.pem ]; then
        mv /usr/share/ssl/private/dovecot.pem /etc/pki/dovecot/private/dovecot.pem
    fi
fi
if [ ! -f /etc/pki/dovecot/certs/dovecot.pem ]; then
SSLDIR=/etc/pki/dovecot OPENSSLCONFIG=/etc/pki/dovecot/dovecot-openssl.cnf \
	/usr/share/doc/dovecot-1.0.7/examples/mkcert.sh &> /dev/null
fi

if ! test -f /var/run/dovecot/login/ssl-parameters.dat; then
    dovecot --build-ssl-parameters &>/dev/null
fi

# Restart if it had been running before installation
if [ -e /var/run/dovecot-restart-after-rpm-install ]; then
  rm /var/run/dovecot-restart-after-rpm-install
  /sbin/service dovecot start >/dev/null 2>&1
fi
exit 0