# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../mailman/mailman.conf
# Copyright (C) 2004 - 2006 The T2 SDE Project
# Copyright (C) 1998 - 2003 Clifford Wolf
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

# Mailman wants its own directory with the proper group rights.
prefix=opt/mailman
set_confopt

# Make sure mailman uses the var prefix.
var_append extraconfopt " " "--with-var-prefix=$localstatedir"

# Make sure Python is installed.
pkgprefix -t python
var_append extraconfopt " " "--with-python=$(pkgprefix bindir python)/python"

# The group id for the http server is needed. Currently we have
# it hardcoded, however when mnemoc has his .tail stuff done
# this should no longer be hardcoded.
var_append extraconfopt " " "--with-cgi-gid=http"

mailman_preconf() {
	# Make sure the prefix directory has the proper access rights.
	chgrp mailman $root/$prefix
	chmod a+rx,g+ws $root/$prefix

	# Also ensure the state dir has the proper access rights.
	chgrp mailman $localstatedir
	chmod a+rx,g+ws $localstatedir
}

mailman_postinstall() {
	# Have mailman check the permissions and correct them
	# if necessary.
	( cd $root/$prefix; bin/check_perms -f )
}

hook_add preconf 5 "mailman_preconf"
hook_add postinstall 5 "mailman_postinstall"