freebsd-ports/mail/mailman/pkg-install
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

60 lines
1.7 KiB
Bash

#! /bin/sh
#
# $FreeBSD$
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
PRE-INSTALL)
echo "---> Starting install script:"
if [ -z "%%MAILMANDIR%%" -o \
-z "%%USER%%" -o -z "%%GROUP%%" -o \
-z "%%UID%%" -o -z "%%GID%%" ]; then
echo "ERROR: A required pragma was empty"
exit 1
fi
# Create group if required
if pw group show "%%GROUP%%" >/dev/null 2>&1; then
echo "---> Using existing group \"%%GROUP%%\""
else
echo "---> Adding group \"%%GROUP%%\" (%%GID%%)"
/usr/sbin/pw groupadd %%GROUP%% -g %%GID%% || exit 1
fi
# Create user if required
if pw user show "%%USER%%" >/dev/null 2>&1; then
echo "---> Using existing user \"%%USER%%\""
else
echo "---> Adding user \"%%USER%%\" (%%UID%%)"
pw useradd "%%USER%%" -u "%%UID%%" -g "%%GROUP%%" -h - \
-d "%%MAILMANDIR%%" -s "/sbin/nologin" -c "Mailman Owner" || exit 1
fi
# Create home directory if required
if [ -d "%%MAILMANDIR%%" ]; then
echo "---> Using existing Mailman directory (%%MAILMANDIR%%)"
echo " (There may be existing active mailing lists - this installation will"
echo " attempt to preserve them.)"
else
echo "---> Creating Mailman directory (%%MAILMANDIR%%)"
(umask 002 && /bin/mkdir -p "%%MAILMANDIR%%") || exit 1
/usr/sbin/chown -R "%%USER%%:%%GROUP%%" "%%MAILMANDIR%%" || exit 1
/bin/chmod g+s "%%MAILMANDIR%%" || exit 1
fi
;;
POST-INSTALL)
echo "---> Starting post-install script:"
echo "---> Creating crontab(5) file for user \"%%USER%%\""
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" || exit 1
echo "---> Checking (and fixing) file and directory permissions"
%%MAILMANDIR%%/bin/check_perms -f >/dev/null 2>&1
;;
esac