summaryrefslogtreecommitdiff
path: root/mail
diff options
context:
space:
mode:
authorJohann Visagie <wjv@FreeBSD.org>2002-02-11 14:24:46 +0000
committerJohann Visagie <wjv@FreeBSD.org>2002-02-11 14:24:46 +0000
commit74c1794a88afcd5678ae09e4c8a4058fb20e2b3e (patch)
treece0255ed267d3acb3b49897f83a359edbe87bacc /mail
parentadd py-pow 0.6.1 (diff)
- Cleaning up the Mailman port, Step 3.
- Add a $PKGDEINSTALL script to allow the port to clean up after itself - Automatically create Mailman user's crontab(5) entry upon port/package installation, and remove it upon deinstallation. - Intended $PKGINSTALL according to personal taste. Converted tabs to spaces. - Remove some extraneous comments from the port's Makefile. (Oops) - Further streamline @exec's in $PLIST. - Bump PORTREVISION - The reworking of this port is an ongoing process - Mailman users, please bear with me!
Notes
Notes: svn path=/head/; revision=54558
Diffstat (limited to 'mail')
-rw-r--r--mail/mailman/Makefile45
-rw-r--r--mail/mailman/pkg-deinstall48
-rw-r--r--mail/mailman/pkg-install120
-rw-r--r--mail/mailman/pkg-message12
-rw-r--r--mail/mailman/pkg-plist3
5 files changed, 144 insertions, 84 deletions
diff --git a/mail/mailman/Makefile b/mail/mailman/Makefile
index 2c6db0ff2391..f41ac45e8ef3 100644
--- a/mail/mailman/Makefile
+++ b/mail/mailman/Makefile
@@ -7,7 +7,7 @@
PORTNAME= mailman
PORTVERSION= 2.0.8
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= mail
MASTER_SITES= http://www.list.org/ \
${MASTER_SITE_GNU} \
@@ -37,12 +37,12 @@ MMDIR?= mailman
# The default value of '1' for MAIL_GID works with sendmail. If you're using
# an alternative MTA installed from ports, you should set MAIL_GID at build
# time according to the following table. (Please contact this port's
-# maintainer if you can fill in the blanks!)
+# maintainer if you can fill in the blanks, or to report mistakes!)
#
-# MTA | MAIL_GID
-# Exim | 6
-# Postfix | ???
-# Qmail | ???
+# MTA | MAIL_GID | Submitted by
+# Exim | 6 | <wjv>
+# Postfix | ??? | <shamrock@cypherpunks.to>
+# Qmail | ??? |
#
MAIL_GID?= 1
CGI_GID?= 80
@@ -50,43 +50,44 @@ CGI_GID?= 80
MAILMANDIR= ${PREFIX}/${MMDIR}
PKGMESSAGE= ${WRKDIR}/pkg-message
PKGINSTALL= ${WRKDIR}/pkg-install
-PLIST_SUB= MMDIR=${MMDIR}
+PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
+PLIST_SUB= MMDIR=${MMDIR} MMGRP=${GROUPNAME}
pre-configure:
-# Add the username, uid, group and gid
-# ${SH} ${FILESDIR}/configure.sh ${USERNAME} ${USERID} ${MAILMANDIR}
-
@ ${SED} -e 's#%%USER%%#${USERNAME}#g' -e 's#%%UID%%#${USERID}#g' \
-e 's#%%GROUP%%#${GROUPNAME}#g' -e 's#%%GID%%#${GROUPID}#g' \
-e 's#%%MAILMANDIR%%#${MAILMANDIR}#g' pkg-install > \
${PKGINSTALL}
@ ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
-# Create the dir and the correct permissions for it.
-#${MKDIR} ${MAILMANDIR}
-#${CHOWN} ${USERNAME}:${USERNAME} ${MAILMANDIR}
-#${CHMOD} 2775 ${MAILMANDIR}
-
post-configure:
+ @ ${SED} -e 's#%%USER%%#${USERNAME}#g' \
+ -e 's#%%GROUP%%#${GROUPNAME}#g' \
+ -e 's#%%MAILMANDIR%%#${MAILMANDIR}#g' pkg-deinstall > \
+ ${PKGDEINSTALL}
@ ${SED} -e 's#%%MAILMANDIR%%#${MAILMANDIR}#g' \
- -e 's#%%DOCSDIR%%#${DOCSDIR}#g' pkg-message > \
- ${PKGMESSAGE}
+ -e 's#%%DOCSDIR%%#${DOCSDIR}#g' pkg-message > ${PKGMESSAGE}
pre-build:
.if !defined(BATCH)
@ ${ECHO_MSG} "-------------------------------------------------------"
@ ${ECHO_MSG} " If you're using an alternative MTA (not Sendmail),"
@ ${ECHO_MSG} " you may have to set MAIL_GID to the gid under which"
- @ ${ECHO_MSG} " your MTA is executing."
+ @ ${ECHO_MSG} " your MTA is executing. See the comments in the"
+ @ ${ECHO_MSG} " port's Makefile for further information."
@ ${ECHO_MSG} "-------------------------------------------------------"
.endif
post-install:
- @${CHOWN} -R :${USERNAME} ${MAILMANDIR}
+.for dir in cron scripts
+ @ ${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py ${MAILMANDIR}/${dir}
+.endfor
+ @ ${CHGRP} -R ${GROUPNAME} ${MAILMANDIR}
+ @ ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
.if !defined(NOPORTDOCS)
- @${MKDIR} ${DOCSDIR}
-.for f in BUGS FAQ INSTALL NEWS README* UPGRADING
- @${INSTALL_DATA} ${WRKSRC}/$f ${DOCSDIR}
+ @ ${MKDIR} ${DOCSDIR}
+.for docfile in BUGS FAQ INSTALL NEWS README* UPGRADING
+ @ ${INSTALL_DATA} ${WRKSRC}/${docfile} ${DOCSDIR}
.endfor
.endif
.if !defined(BATCH)
diff --git a/mail/mailman/pkg-deinstall b/mail/mailman/pkg-deinstall
new file mode 100644
index 000000000000..311e6a8c3048
--- /dev/null
+++ b/mail/mailman/pkg-deinstall
@@ -0,0 +1,48 @@
+#! /bin/sh
+
+delete_account() {
+ local u g home
+
+ u=$1
+ g=$2
+ echo -n "Removing group \"${g}\"... "
+ pw groupdel -n ${g}
+ echo "done."
+ echo -n "Removing user \"${u}\"... "
+ eval home=~${u}
+ echo 'y' | pw userdel -n ${u}
+ echo "done."
+}
+
+zero_crontab() {
+ local u
+
+ u=$1
+
+ echo -n "Zeroing Mailman user's crontab(5) file... "
+ crontab -u ${u} /dev/null || exit
+ echo "done."
+}
+
+export PATH=/bin:/usr/bin:/usr/sbin
+
+case $2 in
+
+DEINSTALL)
+ zero_crontab %%USER%%
+ if ps -axwww | grep -q qrunner; then
+ echo "Killing all running qrunning processes."
+ killall qrunner
+ sleep 2
+ fi
+ ;;
+
+POST-DEINSTALL)
+ 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."
+ else
+ delete_account %%USER%% %%GROUP%%
+ fi
+ ;;
+esac
diff --git a/mail/mailman/pkg-install b/mail/mailman/pkg-install
index f568acca54d7..16f6ff16a700 100644
--- a/mail/mailman/pkg-install
+++ b/mail/mailman/pkg-install
@@ -1,73 +1,89 @@
#! /bin/sh
make_account() {
- local u uid g gid gcos home shell
-
- u=$1
- uid=$2
- g=$3
- gid=$4
- gcos=$5
- home=$6
- shell=$7
-
- if pw group show "${g}" >/dev/null 2>&1; then
- echo "You already have a group \"${g}\", so I will use it."
+ local u uid g gid gcos home shell
+
+ u=$1
+ uid=$2
+ g=$3
+ gid=$4
+ gcos=$5
+ home=$6
+ shell=$7
+
+ if pw group show "${g}" >/dev/null 2>&1; then
+ echo "You already have a group \"${g}\", so I will use it."
+ else
+ echo -n "Adding group \"${g}\" (${gid})... "
+ if which -s pw; then
+ pw groupadd ${g} -g ${gid} || exit
+ echo "done."
else
- echo -n "Adding group \"${g}\" (${gid})... "
- if which -s pw; then
- pw groupadd ${g} -g ${gid} || exit
- echo "done."
- else
- exit 1
- fi
+ exit 1
fi
-
- if pw user show "${u}" >/dev/null 2>&1; then
- echo "You already have a user \"${u}\", so I will use it."
+ fi
+
+ if pw user show "${u}" >/dev/null 2>&1; then
+ echo "You already have a user \"${u}\", so I will use it."
+ else
+ echo -n "Adding user \"${u}\" (${uid})... "
+ if which -s pw; then
+ pw useradd ${u} -u ${uid} -g ${g} -h - -d ${home} \
+ -s ${shell} -c "${gcos}" || exit
+ echo "done."
else
- echo -n "Adding user \"${u}\" (${uid})... "
- if which -s pw; then
- pw useradd ${u} -u ${uid} -g ${g} -h - -d ${home} \
- -s ${shell} -c "${gcos}" || exit
- echo "done."
- else
- exit 1
- fi
+ exit 1
fi
+ fi
- if [ x"$home" != x ]; then
- if [ ! -d "${home}" ]; then
- echo -n "Creating ${u}'s home directory (${home})... "
- (umask 002 && mkdir -p ${home}) || exit
- chown -R ${u}:${g} ${home} || exit
- chmod g+s ${home} || exit
- echo "done."
- fi
+ if [ x"$home" != x ]; then
+ if [ ! -d "${home}" ]; then
+ echo -n "Creating ${u}'s home directory (${home})... "
+ (umask 002 && mkdir -p ${home}) || exit
+ chown -R ${u}:${g} ${home} || exit
+ chmod g+s ${home} || exit
+ echo "done."
fi
+ fi
+}
+
+create_crontab() {
+ local u file
+
+ u=$1
+ file=$2
+
+ echo -n "Creating crontab(5) file for Mailman user... "
+ crontab -u ${u} ${file} || exit
+ echo "done."
+
}
case $2 in
PRE-INSTALL)
- if which -s pw && which -s lockf; then
- :
- else
- cat <<EOF
+ if which -s pw && which -s lockf; then
+ :
+ else
+ cat <<EOF
-This system looks like a pre-2.2 version of FreeBSD. I see that it
-is missing the "lockf" and/or "pw" utilities. I need these utilities.
-Please get them and install them, and try again. You can get the
+This system looks like a pre-2.2 version of FreeBSD. I see that it
+is missing the "lockf" and/or "pw" utilities. I need these utilities.
+Please get them and install them, and try again. You can get the
sources from:
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.bin/lockf.tar.gz
- ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz
+ ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.bin/lockf.tar.gz
+ ftp://ftp.freebsd.org/pub/FreeBSD/FreeBSD-current/src/usr.sbin/pw.tar.gz
EOF
- exit 1
- fi
+ exit 1
+ fi
+
+ make_account %%USER%% %%UID%% %%GROUP%% %%GID%% \
+ "Mailman User" "%%MAILMANDIR%%" "/sbin/nologin"
+ ;;
- make_account %%USER%% %%UID%% %%GROUP%% %%GID%% \
- "Mailman User" "%%MAILMANDIR%%" "/sbin/nologin"
- ;;
+POST-INSTALL)
+ create_crontab %%USER%% "%%MAILMANDIR%%/cron/crontab.in"
+ ;;
esac
diff --git a/mail/mailman/pkg-message b/mail/mailman/pkg-message
index 95c7f18dbe84..aa861b4e8a44 100644
--- a/mail/mailman/pkg-message
+++ b/mail/mailman/pkg-message
@@ -4,17 +4,9 @@ All related binaries have been installed in %%MAILMANDIR%%/bin.
See %%DOCSDIR%%/INSTALL for post-installation instructions,
with "prefix" being "%%MAILMANDIR%%".
-In particular, you'll need to set up the mailman user's crontab(5) entry:
-As root:
-
- # crontab -u mailman %%MAILMANDIR%%/cron/crontab.in
-
A sample entry for Apache's httpd.conf to enable use of Mailman's web
interface:
- ScriptAlias /mailman/ %%MAILMANDIR%%/cgi-bin/
- <Directory %%MAILMANDIR%%/cgi-bin/>
- Options FollowSymLinks ExecCGI
- ... other options ...
- </Directory>
+ ScriptAlias /mailman/ "%%MAILMANDIR%%/cgi-bin/"
+ Alias /pipermail/ "%%MAILMANDIR%%/archives/public/"
---------------------------------------------------------------------------
diff --git a/mail/mailman/pkg-plist b/mail/mailman/pkg-plist
index 2b5a2a2f91e8..a761a4fda472 100644
--- a/mail/mailman/pkg-plist
+++ b/mail/mailman/pkg-plist
@@ -231,6 +231,7 @@
%%MMDIR%%/cron/mailpasswds
%%MMDIR%%/cron/nightly_gzip
%%MMDIR%%/cron/paths.py
+%%MMDIR%%/cron/paths.pyc
%%MMDIR%%/cron/qrunner
%%MMDIR%%/cron/senddigests
@exec chmod 2775 %B
@@ -251,6 +252,7 @@
%%MMDIR%%/scripts/mailcmd
%%MMDIR%%/scripts/mailowner
%%MMDIR%%/scripts/paths.py
+%%MMDIR%%/scripts/paths.pyc
%%MMDIR%%/scripts/post
@exec chmod 2775 %B
%%MMDIR%%/templates/admindbpreamble.html
@@ -282,6 +284,7 @@
%%MMDIR%%/templates/userpass.txt
%%MMDIR%%/templates/verify.txt
@exec chmod 2775 %B
+@exec chgrp -R %%MMGRP%% %%MMDIR%%
%%PORTDOCS%%share/doc/mailman/BUGS
%%PORTDOCS%%share/doc/mailman/FAQ
%%PORTDOCS%%share/doc/mailman/INSTALL