PREIN
/bin/sh
#/usr/sbin/groupadd -f -g 47 zmailer
if ! grep -q "^zmailer:" /etc/group; then
echo "zmailer::47:root,petidomo,uucp,daemon,news" >>/etc/group
fi
PREUN
/bin/sh
if [ -e /var/lock/subsys/zmailer ]; then
/etc/rc.d/init.d/zmailer stop || :
fi
rm -f /var/spool/postoffice/.pid.*
if [ "$1" = "0" ]; then
/sbin/chkconfig --del zmailer
rm -f /var/log/mail/*
fi
POSTIN
/bin/sh
umask 022
/sbin/chkconfig --add zmailer
if [ -x /bin/hostname ]; then
hostname --fqdn >/etc/mail/mailname
fi
if [ -f /etc/mail/router.fc ]; then
rm -f /etc/mail/router.fc
fi
# Gymnastics to convice zmailer to use /etc/mail/aliases
# or provide /etc/mail/aliases it if not found.
if [ ! -L /etc/mail/db/aliases ]; then
if [ -f /etc/mail/aliases ]; then
echo "Generating Symlink to use /etc/mail/aliases for aliasing"
rm -f /etc/mail/db/aliases || echo "Dziwnie pusto w (Strange nothing at) /etc/mail/db/aliases. Ale nie martw siê ... (But don't worry..)"
else
echo "Installing new /etc/mail/aliases from zmailer sample"
mv -f /etc/mail/db/aliases /etc/aliases
fi
ln -sf ../aliases /etc/mail/db/aliases
fi
# Scan for Mandatory entries in /etc/aliases
# postoffice MAILER-DAEMON postmast nobody and other users
# otherwise bad things (tm) result.
if ! grep -q "^hostmaster:" /etc/mail/aliases; then
echo "Adding Entry for hostmaster in /etc/mail/aliases"
echo "hostmaster: root" >>/etc/mail/aliases
fi
for i in postmaster postoffice MAILER-DAEMON postmast nobody webmaster administrator \
ftpmaster newsmaster w3cache squid news proxy abuse ircd; do
if ! grep -q "^$i:" /etc/mail/aliases; then
echo "Adding Entry for $i in /etc/mail/aliases"
echo "$i: hostmaster" >>/etc/mail/aliases
fi
done
# localnames
for x in `hostname --fqdn` `hostname --domain` `hostname --yp`; do
if [ -n $x ] && ! grep -q ^$x /etc/mail/db/localnames; then
echo "$x `hostname --fqdn`|"
fi
done | tr -d '\n' | tr -s '|' '\n' | sort >> /etc/mail/db/localnames
# Rebuild databases
/usr/lib/zmailer/zmailer newdb
/usr/lib/zmailer/policy-builder.sh -n
POSTUN
/bin/sh
if [ "$1" = "0" ]; then
/usr/sbin/groupdel zmailer 2> /dev/null
fi