PREIN
/bin/sh
# Make sure the user "mailman" exists on this system and has the correct values
if grep -q "^mailman:" /etc/group 2> /dev/null ; then
/usr/sbin/groupmod -g 41 -n mailman mailman 2> /dev/null || :
else
/usr/sbin/groupadd -g 41 mailman 2> /dev/null || :
fi
if grep -q "^mailman:" /etc/passwd 2> /dev/null ; then
/usr/sbin/usermod -s /sbin/nologin -c "GNU Mailing List Manager" -d /usr/lib/mailman -u 41 -g 41 mailman 2> /dev/null || :
else
/usr/sbin/useradd -s /sbin/nologin -c "GNU Mailing List Manager" -d /usr/lib/mailman -u 41 -g 41 -M -r mailman 2> /dev/null || :
fi
# Mailman should never be running during an install, but a package upgrade
# shouldn't silently stop the service, so if mailman was running
# we'll leave a temp file in the lock directory as a flag so in
# the post install phase we can restart it.
if [ -d /var/lock/mailman ]; then
rm -f /var/run/mailman-restart-after-rpm-install
/sbin/service mailman status >/dev/null 2>&1
if [ $? -eq 0 ]; then
touch /var/run/mailman-restart-after-rpm-install
/sbin/service mailman stop >/dev/null 2>&1
fi
fi
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0
PREUN
/bin/sh
# if [ $1 = 0 ]' checks that this is the actual deinstallation of
# the package, as opposed to just removing the old package on upgrade.
if [ $1 = 0 ]; then
# These statements stop the service, and remove the /etc/rc*.d links.
/sbin/service mailman stop >/dev/null 2>&1
/sbin/chkconfig --del mailman
fi
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0
POSTIN
/bin/sh
# We no longer use crontab, but previous versions of the spec file did, so clean up
if [ -f /var/spool/cron/mailman ]; then
crontab -u mailman -r
fi
# This adds the proper /etc/rc*.d links for the script that runs the mailman qrunner daemon
chkconfig --add mailman
# Restart mailman if it had been running before installation
if [ -e /var/run/mailman-restart-after-rpm-install ]; then
rm /var/run/mailman-restart-after-rpm-install
/sbin/service mailman start >/dev/null 2>&1
fi
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0
POSTUN
/bin/sh
if [ $1 = 0 ]; then
crontab -u mailman -r 2>/dev/null
fi
# rpm should not abort if last command run had non-zero exit status, exit cleanly
exit 0