Package: mailman
Version: 2.1.9-7

Current behaviour:

The GNU Mailman package's init(8) script assumes that the site list is
called "maiman" and refused to start if there is not list with this
name.

Expected behaviour:

The GNU Mailman package's init(8) script should check for the
MAILMAN_SITE_LIST value defined in /etc/mailman/mm_cfg.py and check
for a list with this name.

Solution:

I have attached a patch which fixes this issue.
--- mailman-2.1.9/debian/mailman.init
+++ mailman-2.1.9/debian/mailman.init
@@ -22,6 +22,8 @@
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/lib/mailman/bin/mailmanctl
 PIDFILE=/var/lib/mailman/data/master-qrunner.pid
+MAILMAN_LIBRARY_DIRECTORY=/usr/lib/mailman/Mailman
+MAILMAN_CONFIGURATION_FILE=/etc/mailman/mm_cfg.py
 
 test -x $DAEMON || exit 0
 
@@ -37,10 +39,33 @@
 
 . /lib/lsb/init-functions
 
+get_site_list_name () {
+    # Load the GNU Mailman configuration and determine the site list name.
+
+    temporary_file_path=$(tempfile)
+    if [ $? -ne 0 ]; then
+        echo "Could not create temporary file."
+        return 1
+    fi
+    echo "import sys" >> $temporary_file_path
+    echo "sys.path.append(\"$MAILMAN_LIBRARY_DIRECTORY\")" >> \
+        $temporary_file_path
+    cat $MAILMAN_CONFIGURATION_FILE >> $temporary_file_path
+    echo "print MAILMAN_SITE_LIST" >> $temporary_file_path
+    site_list_name=$(cat $temporary_file_path | \
+        sudo -u nobody python 2> /dev/null)
+    rm $temporary_file_path
+    if [ -z "$site_list_name" ]; then
+        echo mailman
+    fi
+    echo $site_list_name
+}
+
 case "$1" in
   start)
-    if [ "$(/var/lib/mailman/bin/list_lists -b | grep ^mailman$ )" = "" ]; then
-        log_warning_msg "Site list for mailman (usually named mailman) missing."
+    site_list_name=$(get_site_list_name)
+    if [ "$(/var/lib/mailman/bin/list_lists -b | grep ^$site_list_name\$ )" = "" ]; then
+        log_warning_msg "Site list for mailman (named $site_list_name) missing."
         log_warning_msg "Please create it; until then, mailman will refuse to start."
         exit 0;
     fi

Reply via email to