1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-22 00:35:15 +00:00
freebsd-ports/mail/mailman/files/mailman.in
Matthias Andree 424c099100 Overhaul default hosts configuration.
- When no virtualhosts are defined, and the default localhost/localhost is
  effective, the post-install script now adds DEFAULT_EMAIL_HOST,
  DEFAULT_URL_HOST, and add_virtualhost() lines to mm_cfg.py.

  Add corresponding support to remove unchanged configurations to the
  deinstall script.

- While here, overhaul crontab configuration to only request a merge if the
  crontab had been modified, and unify progress reports.

- Merge pkg-deinstall into pkg-install, to avoid duplication of code
  that might be missed in later maintenance.

PR:		225961
Reported by:	Terry Kennedy
2018-02-17 12:45:18 +00:00

63 lines
2.0 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: mailman
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# 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.
#
# mailman_run_localhost (bool): Set to "YES" to enable running mailman
# with unchanged DEFAULT_URL_HOST and
# DEFAULT_EMAIL_HOST. Default is "NO".
. /etc/rc.subr
name="mailman"
rcvar="mailman_enable"
required_dirs="%%MAILMANDIR%%/lists/mailman"
command_interpreter="%%PYTHON_CMD%%"
command="%%MAILMANDIR%%/bin/mailmanctl"
command_args="start"
pidfile="%%MAILMANDIR%%/data/master-qrunner.pid"
load_rc_config $name
: ${mailman_enable:="NO"}
: ${mailman_fix_perms:="YES"}
: ${mailman_flags:="-s -q"}
: ${mailman_run_localhost:="NO"}
start_precmd=${name}_prestart
extra_commands="reload status reopen"
reopen_cmd="${command} reopen"
mailman_prestart() {
### check/fix permissions if desired
if checkyesno mailman_fix_perms ; then
check_startmsgs && echo "Fixing ${name} permissions:"
env LC_ALL=C %%MAILMANDIR%%/bin/check_perms -f ${rc_debug:+-v}
fi
### check if the default configuration is plausible
vhosts=$(PYTHONPATH="%%MAILMANDIR%%/bin" "%%PYTHON_CMD%%" -c 'import paths;from Mailman import mm_cfg;_x=dict(mm_cfg.VIRTUAL_HOSTS);print repr(_x);')
if [ "${vhosts}" = "{'localhost': 'localhost'}" ] ; then
warn 'No DEFAULT or virtual hosts configured.'
warn 'Review %%DOCSDIR%%/FreeBSD-post-install-notes #1 for instructions.'
if ! checkyesno mailman_run_localhost ; then
err 78 "Start of mailman refused due to insufficient configuration."
fi
fi
}
run_rc_command "$1"