Update rcfile and permission handling.

- Move directory permission handling into pkg-install, to work around
  pkg/libarchive issues on 9.3.
- Handle some crucial directory permissions directly in pkg-install,
  so that running check_perms becomes optional.
- Try a bit harder to preserve permissions on the archives/private dir.
- The rcfile now fixes directory permissions by default on start.
- You can now set mailman_fix_perms="NO" in the /etc/rc.conf* files,
  to avoid running check_perms -f on start, or from pkg-install.
- Clean up pkg-plist.
- Bump PORTREVISION to 6.

Suggested by:	bapt@, peter@
This commit is contained in:
Matthias Andree 2015-01-07 00:12:45 +00:00
parent 525a60aa4a
commit 1661e02b60
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=376446
5 changed files with 89 additions and 138 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= mailman
DISTVERSION= 2.1.18-1
PORTREVISION= 5
PORTREVISION= 6
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_GNU} \
SF/${PORTNAME}/Mailman%202.1%20%28stable%29/${PORTVERSION} \
@ -176,7 +176,7 @@ post-install:
-d ${MAILMANDIR}/${dir} ${dir})
.endfor
@${RM} -f ${STAGEDIR}${MAILMANDIR}/pythonlib/*.egg-info
@# mm_cfg.py is handled by pkg-plist:
@# mm_cfg.py is handled by pkg-plist, no need to archive a copy:
@${RM} -f ${STAGEDIR}${MAILMANDIR}/Mailman/mm_cfg.py
@${RM} -f ${STAGEDIR}${MAILMANDIR}/Mailman/mm_cfg.pyc
@${MKDIR} ${STAGEDIR}${PREFIX}/${IMGDIR}

View file

@ -6,9 +6,15 @@
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable mailman:
# Add the following lines to /etc/rc.conf to enable or configure mailman:
#
# mailman_enable (bool): Set it to "YES" to enable mailman.
# Default is "NO".
#
# mailman_fix_perms (bool): Set it to "NO" to disable running
# check_perms on start or post-install.
# Default is "YES", but this is unsuitable
# for slow machines with many lists.
. /etc/rc.subr
@ -20,6 +26,7 @@ pidfile="%%MAILMANDIR%%/data/master-qrunner.pid"
load_rc_config $name
: ${mailman_enable="NO"}
: ${mailman_fix_perms="YES"}
start_cmd=${name}_start
stop_cmd=${name}_stop
@ -27,7 +34,9 @@ status_cmd=${name}_status
extra_commands="reload status"
mailman_start() {
env LC_ALL=C %%MAILMANDIR%%/bin/check_perms
if checkyesno mailman_fix_perms ; then
env LC_ALL=C %%MAILMANDIR%%/bin/check_perms -f
fi
%%MAILMANDIR%%/bin/mailmanctl -s -q start
}

View file

@ -4,7 +4,7 @@
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
case "$2" in
DEINSTALL)
echo "---> Starting deinstall script"
@ -23,7 +23,7 @@ DEINSTALL)
fi
echo "---> Preserving the \"last_mailman_version\" file"
/bin/mv -f "%%MAILMANDIR%%/data/last_mailman_version" /var/tmp/
/bin/mv -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
@ -34,6 +34,9 @@ DEINSTALL)
echo "---> Deleting errorlog (It is the only existing logfile.)"
/bin/rm -f "%%MAILMANDIR%%/logs/error"
fi
# attempt removal, but do not care if it is not empty
/bin/rmdir "%%MAILMANDIR%%/archives/private/" 2>/dev/null || :
;;
POST-DEINSTALL)

View file

@ -4,21 +4,76 @@
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
check_rcfile_fix_perms() {
(
. /etc/rc.subr
name="mailman"
rcvar=mailman_enable
load_rc_config $name
: ${mailman_fix_perms="YES"}
checkyesno mailman_fix_perms
)
}
set -e
case "$2" in
POST-INSTALL)
echo "---> Starting post-install script"
LC_ALL=C
export LC_ALL
MYTMP="$(mktemp -d "${TMPDIR-/tmp}/mminstall.XXXXXXXXXX")" || exit 1
MYTMP="$(mktemp -d "${TMPDIR-/tmp}/mminstall.XXXXXXXXXX")"
trap "rm -rf \"$MYTMP\"" EXIT
/bin/chmod g+s "%%MAILMANDIR%%" || exit 1
# fix up permissions - this is under investigation; pkg or libarchive
# goof up the group writable and/or setgid bits
/bin/chmod 02770 "%%MAILMANDIR%%/qfiles"
/bin/chmod 02775 "%%MAILMANDIR%%" \
"%%MAILMANDIR%%/Mailman" \
"%%MAILMANDIR%%/bin" \
"%%MAILMANDIR%%/cgi-bin" \
"%%MAILMANDIR%%/icons" \
"%%MAILMANDIR%%/mail" \
"%%MAILMANDIR%%/scripts" \
"%%MAILMANDIR%%/tests" \
"%%MAILMANDIR%%/pythonlib" \
"%%MAILMANDIR%%/spam" \
"%%MAILMANDIR%%/locks" \
"%%MAILMANDIR%%/Mailman/Archiver" \
"%%MAILMANDIR%%/Mailman/Bouncers" \
"%%MAILMANDIR%%/Mailman/Cgi" \
"%%MAILMANDIR%%/Mailman/Commands" \
"%%MAILMANDIR%%/Mailman/Gui" \
"%%MAILMANDIR%%/Mailman/Handlers" \
"%%MAILMANDIR%%/Mailman/Logging" \
"%%MAILMANDIR%%/Mailman/MTA" \
"%%MAILMANDIR%%/Mailman/Queue" \
"%%MAILMANDIR%%/tests/bounces" \
"%%MAILMANDIR%%/tests/msgs" \
"%%MAILMANDIR%%/cron" \
"%%MAILMANDIR%%/data" \
"%%MAILMANDIR%%/lists" \
"%%MAILMANDIR%%/archives" \
"%%MAILMANDIR%%/archives/public"
# this can be 2770 or 2771 but should not be stomped over
test -d "%%MAILMANDIR%%/archives/private" \
|| /usr/bin/install -d -m 02771 \
"%%MAILMANDIR%%/archives/private" -g "%%GROUP%%"
/bin/chmod u+rwx,g+srwx "%%MAILMANDIR%%/archives/private"
/bin/chmod u+rwx,g+srwx,o+rx "%%MAILMANDIR%%/logs"
/usr/bin/find "%%MAILMANDIR%%/messages" "%%MAILMANDIR%%/templates" -type d \
-exec chmod 02775 '{}' +
echo "---> Running update"
LC_ALL=C "%%MAILMANDIR%%/bin/update" || exit 1
LC_ALL=C "%%MAILMANDIR%%/bin/update"
echo "---> Checking crontab(5) file for user \"%%USER%%\""
@ -34,24 +89,28 @@ POST-INSTALL)
echo "---> %%MAILMANDIR%%/cron/crontab.in"
else
echo "---> Installing crontab(5) file for user \"%%USER%%\""
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" || exit 1
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in"
fi
else
echo "---> Creating crontab(5) file for user \"%%USER%%\""
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in" || exit 1
/usr/bin/crontab -u "%%USER%%" "%%MAILMANDIR%%/cron/crontab.in"
fi
rm -f "$MYTMP/crontab"
echo "---> Checking (and fixing) file and directory permissions"
output="$("%%MAILMANDIR%%/bin/check_perms" -f 2>&1)"
printf '%s\n' "$output" | egrep -v '^Re-run' || :
if check_rcfile_fix_perms ; then
echo "---> Checking (and fixing) file and directory permissions"
output="$("%%MAILMANDIR%%/bin/check_perms" -f 2>&1)" || :
printf '%s\n' "$output" | egrep -v '^Re-run' || :
else
echo "---> rcfile sets mailman_fix_perms to no, skipping check_perms"
fi
echo "---> Running assorted other checks"
if egrep -q "^[ \t]*MTA.*=.*Postfix" "%%MAILMANDIR%%/Mailman/mm_cfg.py" ; then
# run Postfix-specific checks
if [ "x`${PKG_PREFIX}/sbin/postconf -h myhostname`" != "xlocalhost" ] \
&& ! egrep "^[ \t]*SMTPHOST.*=.*`${PKG_PREFIX}/sbin/postconf -h myhostname`" \
"%%MAILMANDIR%%/Mailman/mm_cfg.py"
&& ! egrep -q "^[ \t]*SMTPHOST.*=.*`${PKG_PREFIX}/sbin/postconf -h myhostname`" \
"%%MAILMANDIR%%/Mailman/mm_cfg.py"
then
echo ""
echo "Your Postfix hostname is non-default."
@ -61,5 +120,4 @@ POST-INSTALL)
fi
fi
;;
esac

View file

@ -2254,128 +2254,10 @@
%%MMDIR%%/tests/test_smtp.py
%%MMDIR%%/tests/testall.py
%%PYTHON_SITELIBDIR%%/mailman-info.txt
@comment @dir %%PYTHON_SITELIBDIR%%
@dir %%MMDIR%%/tests/msgs
@dir %%MMDIR%%/tests/bounces
@dir %%MMDIR%%/tests
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/zh_TW
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/zh_CN
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/vi
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/uk
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/tr
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/sv
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/sr
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/sl
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/sk
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/ru
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/ro
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/pt_BR
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/pt
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/pl
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/no
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/nl
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/lt
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/ko
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/ja
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/it
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/ia
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/hu
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/hr
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/he
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/gl
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/fr
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/fi
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/fa
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/eu
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/et
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/es
@dir(,,02775) %%MMDIR%%/templates/en
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/el
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/de
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/da
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/cs
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/ca
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/ast
%%NLS%%@dir(,,02775) %%MMDIR%%/templates/ar
@dir %%MMDIR%%/templates
@dir %%MMDIR%%/scripts
%%NLS%%@dir %%MMDIR%%/messages/ast/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/ast
%%NLS%%@dir %%MMDIR%%/messages/zh_TW/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/zh_TW
%%NLS%%@dir %%MMDIR%%/messages/zh_CN/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/zh_CN
%%NLS%%@dir %%MMDIR%%/messages/vi/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/vi
%%NLS%%@dir %%MMDIR%%/messages/uk/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/uk
%%NLS%%@dir %%MMDIR%%/messages/tr/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/tr
%%NLS%%@dir %%MMDIR%%/messages/sv/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/sv
%%NLS%%@dir %%MMDIR%%/messages/sr/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/sr
%%NLS%%@dir %%MMDIR%%/messages/sl/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/sl
%%NLS%%@dir %%MMDIR%%/messages/sk/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/sk
%%NLS%%@dir %%MMDIR%%/messages/ru/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/ru
%%NLS%%@dir %%MMDIR%%/messages/ro/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/ro
%%NLS%%@dir %%MMDIR%%/messages/pt_BR/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/pt_BR
%%NLS%%@dir %%MMDIR%%/messages/pt/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/pt
%%NLS%%@dir %%MMDIR%%/messages/pl/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/pl
%%NLS%%@dir %%MMDIR%%/messages/no/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/no
%%NLS%%@dir %%MMDIR%%/messages/nl/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/nl
%%NLS%%@dir %%MMDIR%%/messages/lt/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/lt
%%NLS%%@dir %%MMDIR%%/messages/ko/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/ko
%%NLS%%@dir %%MMDIR%%/messages/ja/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/ja
%%NLS%%@dir %%MMDIR%%/messages/it/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/it
%%NLS%%@dir %%MMDIR%%/messages/ia/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/ia
%%NLS%%@dir %%MMDIR%%/messages/hu/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/hu
%%NLS%%@dir %%MMDIR%%/messages/hr/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/hr
%%NLS%%@dir %%MMDIR%%/messages/he/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/he
%%NLS%%@dir %%MMDIR%%/messages/gl/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/gl
%%NLS%%@dir %%MMDIR%%/messages/fr/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/fr
%%NLS%%@dir %%MMDIR%%/messages/fi/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/fi
%%NLS%%@dir %%MMDIR%%/messages/fa/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/fa
%%NLS%%@dir %%MMDIR%%/messages/eu/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/eu
%%NLS%%@dir %%MMDIR%%/messages/et/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/et
%%NLS%%@dir %%MMDIR%%/messages/es/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/es
%%NLS%%@dir %%MMDIR%%/messages/el/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/el
%%NLS%%@dir %%MMDIR%%/messages/de/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/de
%%NLS%%@dir %%MMDIR%%/messages/da/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/da
%%NLS%%@dir %%MMDIR%%/messages/cs/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/cs
%%NLS%%@dir %%MMDIR%%/messages/ca/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/ca
%%NLS%%@dir %%MMDIR%%/messages/ar/LC_MESSAGES
%%NLS%%@dir(,,02775) %%MMDIR%%/messages/ar
%%NLS%%@dir(,,02775) %%MMDIR%%/messages
@dir %%MMDIR%%/mail
@dir %%MMDIR%%/icons
@dir %%MMDIR%%/cron
@ -2399,9 +2281,8 @@
@dir %%MMDIR%%/lists
@dir %%MMDIR%%/data
@dir %%MMDIR%%/archives/public
@dir(,,02770) %%MMDIR%%/archives/private
@comment @dir %%MMDIR%%/archives/private
%%SUB_HTDIG%%@dir %%MMDIR%%/archives/htdig
@dir %%MMDIR%%/archives
@dir %%MMDIR%%/Mailman
@dir(,,02775) %%MMDIR%%
@group