- Correct GROUP when postfix OPTION is selected [1]

- Add nobody user and group to UIDs/GIDs for mail/mailman [2]
- Stop touching files outside WRKDIR before install [2]
- Use USERS and GROUPS [2]
- Change BROKEN to IGNORE for incorrect OPTIONS choices [2]
- Use @stopdaemon [2]
- Correct rc script to check for pidfile before attempting kill [2]

PR:		ports/142000
Submitted by:	Adriaan <ratten.adriaan@gmail.com> [1], crees [2]
Approved by:	rene (mentor), wxs (maintainer)
This commit is contained in:
Chris Rees 2011-06-13 19:22:25 +00:00
parent 28fbd44e73
commit ccc31701b6
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=275498
8 changed files with 39 additions and 77 deletions

1
GIDs
View File

@ -209,3 +209,4 @@ gnokii:*:947:
dnrd:*:948:
dbxml:*:949:
conquest:*:950:
nobody:*:65534:

1
UIDs
View File

@ -214,3 +214,4 @@ dbxml:*:945:945::0:0:& user:/nonexistent:/sbin/nologin
sybase:*:946:946::0:0:& user:/usr/local/sybase-ase:/sbin/nologin
dnrd:*:948:948::0:0:& user:/nonexistent:/sbin/nologin
dbxml:*:949:949::0:0:dbXML user:/nonexistent:/sbin/nologin
nobody:*:65534:65534:Unprivileged user:/nonexistent:/usr/sbin/nologin

View File

@ -5,6 +5,15 @@ they are unavoidable.
You should get into the habit of checking this file for changes each time
you update your ports collection, before attempting any port upgrades.
20110613:
AFFECTS: users of mail/mailman with postfix
AUTHOR: crees@FreeBSD.org
The mailman port has for some time specified the incorrect group when
using with Postfix, as reported in ports/142000. The group for mailman
is now nobody if compiled with Postfix. Be prepared to make appropriate
adjustments if you have compensated for this bug in the past.
20110608:
AFFECTS: users of security/amavisd-milter
AUTHOR: delphij@FreeBSD.org

View File

@ -7,7 +7,7 @@
PORTNAME= mailman
DISTVERSION= 2.1.14
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES?= mail
MASTER_SITES= ${MASTER_SITE_GNU} \
SF/${PORTNAME}/Mailman%202.1%20%28stable%29/${PORTVERSION}
@ -27,13 +27,15 @@ OPTIONS= SENDMAIL "for use with sendmail" off \
HTDIG "htdig integration patches" off \
NAMAZU2 "make private archives searchable with namazu2" off
HAS_CONFIGURE= yes
USE_AUTOTOOLS= autoconf
GNU_CONFIGURE_PREFIX= ${MAILMANDIR}
USE_PYTHON= yes
MAKE_JOBS_SAFE= yes
CONFIGURE_ARGS+= --prefix=${MAILMANDIR} --with-python=${PYTHON_CMD} \
CONFIGURE_ARGS+=--with-python=${PYTHON_CMD} \
--with-username=${MM_USERNAME} \
--with-groupname=${MM_GROUPNAME} \
--with-mail-gid=${MAIL_GID} --with-cgi-gid=${CGI_GID}
--with-mail-gid=${MAIL_GID} --with-cgi-gid=${CGI_GID} \
--with-permcheck=no
SUB_FILES= pkg-message
SUB_LIST+= MAILMANDIR=${MAILMANDIR}
USE_RC_SUBR= mailman
@ -51,6 +53,9 @@ IMGDIR?= www/icons
#
# End of user-configurable variables.
USERS= ${MM_USERNAME}
GROUPS= ${MM_GROUPNAME}
MAILMANDIR= ${PREFIX}/${MM_DIR}
PKGINSTALL= ${WRKDIR}/pkg-install
PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
@ -69,7 +74,7 @@ IMGFILES= PythonPowered.png mailman.jpg mm-icon.png
.if defined(WITH_SENDMAIL)
.if defined(WITH_EXIM3) || defined(WITH_EXIM4) || defined(WITH_POSTFIX) || \
defined(WITH_COURIER)
BROKEN= choose only one MTA integration
IGNORE= can only have one MTA selected to integrate with
.endif
MAIL_GID?= mailnull
.endif
@ -77,7 +82,7 @@ MAIL_GID?= mailnull
.if defined(WITH_EXIM3)
.if defined(WITH_SENDMAIL) || defined(WITH_EXIM4) || defined(WITH_POSTFIX) || \
defined(WITH_COURIER)
BROKEN= choose only one MTA integration
IGNORE= can only have one MTA selected to integrate with
.endif
MAIL_GID?= nobody
.endif
@ -85,7 +90,7 @@ MAIL_GID?= nobody
.if defined(WITH_EXIM4)
.if defined(WITH_SENDMAIL) || defined(WITH_EXIM3) || defined(WITH_POSTFIX) || \
defined(WITH_COURIER)
BROKEN= choose only one MTA integration
IGNORE= can only have one MTA selected to integrate with
.endif
MAIL_GID?= mail
.endif
@ -93,16 +98,16 @@ MAIL_GID?= mail
.if defined(WITH_POSTFIX)
.if defined(WITH_SENDMAIL) || defined(WITH_EXIM3) || defined(WITH_EXIM4) || \
defined(WITH_COURIER)
BROKEN= choose only one MTA integration
IGNORE= can only have one MTA selected to integrate with
.endif
MAIL_GID?= mailman
MAIL_GID?= nobody
EXTRA_PATCHES+= ${FILESDIR}/postfix-verp.diff
.endif
.if defined(WITH_COURIER)
.if defined(WITH_SENDMAIL) || defined(WITH_EXIM3) || defined(WITH_EXIM4) || \
defined(WITH_POSTFIX)
BROKEN= choose only one MTA integration
IGNORE= can only have one MTA selected to integrate with
.endif
MAIL_GID?= courier
.endif
@ -149,29 +154,18 @@ pre-fetch:
post-patch:
@${REINPLACE_CMD} -e 's#%%LOCALBASE%%#${LOCALBASE}#g' \
${WRKSRC}/Mailman/Defaults.py.in
pre-configure::
# Mailman's configure script needs the "mailman" user/group to exist, so
# $PKGINSTALL has to be patched before the do-configure target executes.
# Disable username check in configure -- we promise to make the users!
@${REINPLACE_CMD} \
-e 's#^MM_FIND_\([^_]*\)_NAME.*#MAILMAN_\1=$${\1NAME}#' \
${WRKSRC}/configure.in
@${SED} \
-e 's#%%USER%%#${MM_USERNAME}#g' -e 's#%%UID%%#${MM_USERID}#g' \
-e 's#%%GROUP%%#${MM_GROUPNAME}#g' -e 's#%%GID%%#${MM_GROUPID}#g' \
-e 's#%%MAILMANDIR%%#${MAILMANDIR}#g' ${MASTERDIR}/pkg-install > \
${PKGINSTALL}
@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-configure:
-e 's#%%USER%%#${MM_USERNAME}#g' \
-e 's#%%MAILMANDIR%%#${MAILMANDIR}#g' \
${MASTERDIR}/pkg-install > ${PKGINSTALL}
@${SED} \
-e 's#%%USER%%#${MM_USERNAME}#g' -e 's#%%GROUP%%#${MM_GROUPNAME}#g' \
-e 's#%%PREFIX%%#${PREFIX}#g' -e 's#%%MAILMANDIR%%#${MAILMANDIR}#g' \
${MASTERDIR}/pkg-deinstall > ${PKGDEINSTALL}
# port system auditors complain if dir is created prior to install
# but configure demands it be there. we delete it now if empty,
# so it will be re-created. For existing installs, this is ignored
@- ${RMDIR} ${MAILMANDIR} 2> /dev/null
pre-install:
@${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL
post-install:
@${RM} -f ${MAILMANDIR}/pythonlib/*.egg-info

View File

@ -30,7 +30,9 @@ mailman_start() {
}
mailman_stop() {
%%MAILMANDIR%%/bin/mailmanctl -q stop
[ -f $pidfile ] \
&& %%MAILMANDIR%%/bin/mailmanctl -q stop \
|| echo ${name} not running? (check ${pidfile})
}
run_rc_command "$1"

View File

@ -23,10 +23,6 @@ DEINSTALL)
echo "---> /usr/bin/crontab -u "%%USER%%" -r"
fi
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/
@ -51,10 +47,6 @@ POST-DEINSTALL)
/bin/mv -f /var/tmp/last_mailman_version %%MAILMANDIR%%/data/
fi
echo '---> - If you are not using Mailman any more, you should manually delete'
echo '---> - the "%%USER%%" user and "%%GROUP%%" group.'
echo '---> - You may delete them with "pw groupdel %%GROUP%%; pw userdel %%USER%%".'
;;
esac

View File

@ -6,49 +6,11 @@ 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:"
/bin/chmod g+s "%%MAILMANDIR%%" || exit 1
echo "---> Checking crontab(5) file for user \"%%USER%%\""
if [ -e /var/cron/allow ]; then

View File

@ -1,4 +1,5 @@
@comment $FreeBSD$
@stopdaemon mailman
@unexec if cmp -s %D/%%MMDIR%%/Mailman/mm_cfg.py %D/%%MMDIR%%/Mailman/mm_cfg.py.dist; then rm -f %D/%%MMDIR%%/Mailman/mm_cfg.py; fi
@unexec rm -f %D/%%MMDIR%%/Mailman/mm_cfg.pyc
@exec mkdir -p %D/%%MMDIR%%/archives