PREIN
/bin/sh
/usr/share/rpm-helper/add-user postfix $1 postfix /var/spool/postfix /bin/false
/usr/share/rpm-helper/add-group postfix $1 postdrop postfix
# disable chroot of spawn service in /etc/sysconfig/postfix, but do it only once and only if user did not
# modify /etc/sysconfig/postfix manually
if grep -qs "^NEVER_CHROOT_PROGRAM='^(proxymap|local|pipe|virtual)$'$" /etc/sysconfig/postfix; then
if ! grep -qs "^NEVER_CHROOT_PROGRAM='^(proxymap|local|pipe|virtual|spawn)$'$" /usr/sbin/postfix-chroot.sh; then
perl -pi -e "s/^NEVER_CHROOT_PROGRAM=.*\$/NEVER_CHROOT_PROGRAM=\'^(proxymap|local|pipe|virtual|spawn)\\\$\'/" /etc/sysconfig/postfix
fi
fi
PREUN
/bin/sh
rmqueue() {
[ $2 -gt 0 ] || return
local i
for i in 0 1 2 3 4 5 6 7 8 9 A B C D E F; do
if [ -d $1/$i ]; then
rmqueue $1/$i $(( $2 - 1 ))
rm -f $1/$i/*
rmdir $1/$i
fi
done
}
# selectively remove the queue directory structure
queue_directory_remove () {
# first remove the "queues"
local IFS=', '
for dir in `/usr/sbin/postconf -h hash_queue_names`; do
test -d $dir && rmqueue /var/spool/postfix/$dir `/usr/sbin/postconf -h hash_queue_depth`
done
# now remove the other directories
for dir in corrupt maildrop pid private public trace; do
test -d $dir && /bin/rm -f $dir/*
done
}
/usr/share/rpm-helper/del-service postfix $1 postfix
if [ $1 = 0 ]; then
# Clean up chroot environment and spool directory
/usr/sbin/postfix-chroot.sh -q remove
cd /var/spool/postfix && queue_directory_remove || true
fi
POSTIN
/bin/sh
# we don't have these maps anymore as separate packages/plugins:
# cidr, tcp and sdbm (2007.0)
if [ "$1" -eq "2" ]; then
sed -i "/^cidr/d;/^sdbm/d;/^tcp/d" /etc/postfix/dynamicmaps.cf
fi
# upgrade configuration files if necessary
/usr/sbin/postfix \
set-permissions \
upgrade-configuration \
config_directory=/etc/postfix \
daemon_directory=/usr/lib/postfix command_directory=/usr/sbin queue_directory=/var/spool/postfix sendmail_path=/usr/sbin/sendmail.postfix newaliases_path=/usr/bin/newaliases mailq_path=/usr/bin/mailq mail_owner=postfix setgid_group=postdrop manpage_directory=/usr/share/man readme_directory=/usr/share/doc/postfix/README_FILES html_directory=/usr/share/doc/postfix/html data_directory=/var/lib/postfix
# move previous sasl configuration files to new location if applicable
# have to go through many loops to prevent damaging user configuration
# this changed around 2007.0 so it should go away soon
saslpath=`postconf -h smtpd_sasl_path`
if [ "${saslpath}" != "${saslpath##*:}" -o "${saslpath}" != "${saslpath##*/usr/lib}" ]; then
postconf -e smtpd_sasl_path=smtpd
fi
for old_smtpd_conf in /etc/postfix/sasl/smtpd.conf /usr/lib/sasl2/smtpd.conf; do
if [ -e ${old_smtpd_conf} ]; then
if ! grep -qsve '^\(#.*\|[[:space:]]*\)$' /etc/sasl2/smtpd.conf; then
# /etc/sasl2/smtpd.conf missing or just comments
if [ -s /etc/sasl2/smtpd.conf ] && [ ! -e /etc/sasl2/smtpd.conf.rpmnew -o /etc/sasl2/smtpd.conf -nt /etc/sasl2/smtpd.conf.rpmnew ]; then
mv /etc/sasl2/smtpd.conf /etc/sasl2/smtpd.conf.rpmnew
fi
mv ${old_smtpd_conf} /etc/sasl2/smtpd.conf
else
echo "warning: existing ${old_smtpd_conf} will be ignored"
fi
fi
done
if [ -e /etc/sysconfig/postfix ]; then
/usr/sbin/postfix-chroot.sh -q update
else
/usr/sbin/postfix-chroot.sh -q enable
fi
/usr/share/rpm-helper/add-service postfix $1 postfix
/usr/sbin/update-alternatives --install /usr/sbin/sendmail sendmail-command /usr/sbin/sendmail.postfix 30 --slave /usr/lib/sendmail sendmail-command-in_libdir /usr/sbin/sendmail.postfix
POSTUN
/bin/sh
/usr/share/rpm-helper/del-user postfix $1 postfix
/usr/share/rpm-helper/del-group postfix $1 postdrop
if [ ! -e /usr/sbin/sendmail.postfix ]; then
/usr/sbin/update-alternatives --remove sendmail-command /usr/sbin/sendmail.postfix
fi
Triggers
glibc
/bin/sh
# Generate chroot jails on the fly when needed things are installed/upgraded
/usr/sbin/postfix-chroot.sh -q update
setup
/bin/sh
# Generate chroot jails on the fly when needed things are installed/upgraded
/usr/sbin/postfix-chroot.sh -q update
nss_ldap
/bin/sh
# Generate chroot jails on the fly when needed things are installed/upgraded
/usr/sbin/postfix-chroot.sh -q update
nss_db
/bin/sh
# Generate chroot jails on the fly when needed things are installed/upgraded
/usr/sbin/postfix-chroot.sh -q update
nss_wins
/bin/sh
# Generate chroot jails on the fly when needed things are installed/upgraded
/usr/sbin/postfix-chroot.sh -q update
nss_mdns
/bin/sh
# Generate chroot jails on the fly when needed things are installed/upgraded
/usr/sbin/postfix-chroot.sh -q update