1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-30 05:40:06 +00:00
freebsd-ports/mail/mailman/pkg-deinstall
Johann Visagie 9fb9d105a9 - Update author's email address in $DESCR.
- Update $PKGREQ to depend explicitly on Python >= 2.1.3, and not just >= 2.1
- Document required value of $MAIL_GID for Exim4.
- Substantial rewrite of $PKGINSTALL:
  - Simplified layout.
  - More extensive error checking.
  - More expressive and user-friendly output.
- Substantial rewrite of $PKGDEINSTALL:
  - Simplified layout.
  - More expressive and user-friendly output.
  - Delete %%MAILMANDIR%%/data/last_mailman_version in DEINSTALL, and restore
    it in POST-DEINSTALL if the entire Mailman installation has not been
    removed.  This file is required by Mailman's update script (run as part
    of the installation procedure) to update active mailing lists.
  - Delete the errorlog if it is the only existing logfile.  This will
    finally allow the mailman port/package to be completely and cleanly
    deinstalled when there are no active lists or updated configuration.
- Bump $PORTREVISION, with apologies to those tracking the port.

It should now finally be possible to update a Mailman installation with
active mailing lists simply by deinstalling the port/package, and
reinstalling a later version (or by using portupgrade(1)).  There are still
no guarantees, though, and a backup is thorouhly recommended.
2003-01-23 12:49:00 +00:00

55 lines
1.8 KiB
Bash

#! /bin/sh
#
# $FreeBSD$
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
DEINSTALL)
echo "---> Starting deinstall script:"
echo "---> Zeroing crontab(5) file belonging to user \"%%USER%%\""
/usr/bin/crontab -u %%USER%% /dev/null
echo " (The crontab(5) will be deleted completely when user %%USER%% is removed.)"
echo "---> Stopping Mailman's qrunner daemon"
%%PREFIX%%/etc/rc.d/mailman.sh stop >/dev/null 2>&1
/bin/sleep 2
echo "---> Preserving the \"last_mailman_version\" file"
/bin/cp -f %%MAILMANDIR%%/data/last_mailman_version /var/tmp/
# If the errorlog is the only existing logfile, delete it. (If Mailman's
# qrunner had not been running, then the process of trying to stop the
# qrunner (above) will cause the errorlog to be written to. Hence, even if
# the Mailman port/package is installed and immediately deinstalled, the
# errorlog will exist.)
if [ "`echo %%MAILMANDIR%%/logs/*`" = "%%MAILMANDIR%%/logs/error" ]; then
echo "---> Deleting errorlog (It is the only existing logfile.)"
/bin/rm -f %%MAILMANDIR%%/logs/error
fi
;;
POST-DEINSTALL)
echo "---> Starting post-deinstall script:"
if [ -d %%MAILMANDIR%% ]; then
echo '---> %%MAILMANDIR%% is not empty - this installation may have active lists!'
echo '---> - The "%%USER%%" user and "%%GROUP%%" group were therefore not deleted.'
echo '---> - You may delete them with "pw groupdel %%GROUP%%; pw userdel %%USER%%".'
echo "---> Restoring \"last_mailman_version\" file"
[ -d %%MAILMANDIR%%/data ] || /bin/mkdir %%MAILMANDIR%%/data
/bin/mv -f /var/tmp/last_mailman_version %%MAILMANDIR%%/data/
else
echo "---> Removing group \"%%GROUP%%\""
/usr/sbin/pw groupdel -n %%GROUP%%
echo "---> Removing user \"%%USER%%\""
echo 'y' | /usr/sbin/pw userdel -n %%USER%%
fi
;;
esac