PREIN
/bin/sh
if [ -n "`/usr/bin/getgid postfix`" ]; then
if [ "`/usr/bin/getgid postfix`" != "62" ]; then
echo "Error: group postfix doesn't have gid=62. Correct this before installing postfix." 1>&2
exit 1
fi
else
echo "Adding group postfix GID=62."
/usr/sbin/groupadd -g 62 -r postfix 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/usr/bin/getgid maildrop`" ]; then
if [ "`/usr/bin/getgid maildrop`" != "63" ]; then
echo "Error: group maildrop doesn't have gid=63. Correct this before installing postfix." 1>&2
exit 1
fi
else
echo "Adding group maildrop GID=63."
/usr/sbin/groupadd -g 63 -r maildrop 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || :
fi;
if [ -n "`/bin/id -u postfix 2>/dev/null`" ]; then
if [ "`/bin/id -u postfix`" != "62" ]; then
echo "Error: user postfix doesn't have uid=62. Correct this before installing postfix." 1>&2
exit 1
fi
else
echo "Adding user postfix UID=62."
/usr/sbin/useradd \
\
-u 62 \
-r \
-d /var/spool/postfix \
-s /bin/false \
-c "Postfix User"\
-g postfix \
\
\
postfix 1>&2 || exit $?
[ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || :
fi;
PREUN
/bin/sh
if [ "$1" = "0" ]; then
{
if [ -f /var/lock/subsys/postfix ]; then
/sbin/service postfix stop 1>&2 || :;
fi }; /sbin/chkconfig --del postfix
fi
POSTIN
/bin/sh
/sbin/ldconfig
if ! grep -q "^postmaster:" /etc/mail/aliases; then
echo "Adding Entry for postmaster in /etc/mail/aliases" >&2
echo "postmaster: root" >>/etc/mail/aliases
fi
if [ "$1" = "1" ]; then
# only on installation, not upgrade
if ! grep -q "^myhostname" /etc/mail/main.cf; then
postconf -e myhostname=`/bin/hostname -f`
fi
else
postfix upgrade-configuration
fi
newaliases
/sbin/chkconfig --add postfix
{
skip_auto_restart() {
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm
[ -f /etc/sysconfig/postfix ] && . /etc/sysconfig/postfix
echo ${RPM_SKIP_AUTO_RESTART:-no}
};
if [ $(skip_auto_restart) = no ]; then
if [ -f /var/lock/subsys/postfix ]; then
/sbin/service postfix restart 1>&2 || :;
else
echo 'Run "/sbin/service postfix start" to start postfix daemon.'
fi
fi };
POSTUN
/bin/sh
/sbin/ldconfig
if [ "$1" = "0" ]; then
/usr/lib/rpm/user_group.sh group del maildrop
/usr/lib/rpm/user_group.sh user del postfix
/usr/lib/rpm/user_group.sh group del postfix
fi