[Pkg-mailman-hackers] Pkg-mailman commit - rev 131 - branches/pkg-split/core/debian

Bernd S. Brentrup bsb@haydn.debian.org
Tue, 18 May 2004 10:34:58 -0600


Author: bsb
Date: 2004-05-18 10:34:54 -0600 (Tue, 18 May 2004)
New Revision: 131

Modified:
   branches/pkg-split/core/debian/mailman-en.postinst
   branches/pkg-split/core/debian/mailman-en.prerm
Log:
Making sure master qrunner is restarted when mailman
and either of mailman-i18n or mailman-en is configured.


Modified: branches/pkg-split/core/debian/mailman-en.postinst
===================================================================
--- branches/pkg-split/core/debian/mailman-en.postinst	2004-05-18 16:29:43 UTC (rev 130)
+++ branches/pkg-split/core/debian/mailman-en.postinst	2004-05-18 16:34:54 UTC (rev 131)
@@ -13,7 +13,6 @@
 
 import sys, os
 
-
 # Argl, if the debconf Python interface were well designed, sth like
 #   from debconf import instance as db
 # should be sufficient here.  As it is, must work around it's flaws.
@@ -29,14 +28,17 @@
 #  Exception class and convenience constants
 from debconf import DebconfError, LOW, MEDIUM, HIGH, CRITICAL
 
+print >>sys.stderr, '>>>', sys.argv
 
-PACKAGE='mailman-i18n'
-MM_HOME = '/var/lib/mailman'
+PACKAGE='mailman-en'
+MM_INST = '/usr/lib/mailman'
 
-sys.path.insert(0, MM_HOME)
 
-from Mailman.Debian import DebuggingLogger, cfdb, mm_languages
+# mailman (and thus the Mailman py package) may not be installed yet
+sys.path.insert(0, os.path.join(MM_INST, 'Mailman'))
+from Debian import DebuggingLogger, cfdb, mm_languages
 
+
 from errno import EEXIST, ENOTEMPTY
 #from errno import *
 
@@ -73,8 +75,6 @@
     remove_templates(need_languages)
     install_templates(need_languages)
 
-    start_mailman()
-
     db.fset('mailman/site_languages', 'seen', 'false')
 
 
@@ -121,12 +121,14 @@
         log(' done.')
 
 
-def start_mailman():
+def start_mm_qrunner():
+    log('>> entering start_mm_qrunner', lvl=3)
+    if not cfdb.has_key('mailman/setup'):
+        log('Must reconfigure mailman to restart daemons.')
+        return
     from popen2 import Popen4
     runner = Popen4('/bin/sh -e')
     runner.tochild.write("""\
-chmod +x /var/lib/mailman/bin/mailmanctl
-
 if [ -x "/etc/init.d/mailman" ]; then
   if [ -x /usr/sbin/invoke-rc.d ] ; then
     invoke-rc.d mailman start || true
@@ -151,8 +153,9 @@
         op = sys.argv[1]
         if op == 'configure':
             setup()
-        elif op in ('abort-upgrade','abort-remove','abort-deconfigure'):
-            pass
+        if op in ('configure', 'abort-upgrade','abort-remove','abort-deconfigure'):
+            cfdb['mailman/templates'] = PACKAGE
+            start_mm_qrunner()
         else:
             log("postinst called with unknown argument \`%s'" % op)
             raise SystemExit(1)

Modified: branches/pkg-split/core/debian/mailman-en.prerm
===================================================================
--- branches/pkg-split/core/debian/mailman-en.prerm	2004-05-18 16:29:43 UTC (rev 130)
+++ branches/pkg-split/core/debian/mailman-en.prerm	2004-05-18 16:34:54 UTC (rev 131)
@@ -2,13 +2,40 @@
 # $URL$
 # $Id$
 
-if [ "$1" = "upgrade" ] ; then
-  if [ -x "/etc/init.d/mailman" ]; then
-    if [ -x /usr/sbin/invoke-rc.d ] ; then
-      invoke-rc.d mailman stop || true
-    else
-      /etc/init.d/mailman stop || true
+echo ">>> $0 $*" >&2
+
+package=mailman-en
+
+unset_mm_templates () {
+python <<EOF
+import sys; sys.path.insert(0, '/usr/lib/mailman/Mailman')
+try:
+    from Debian import cfdb
+    del cfdb['mailman/templates']
+except:
+    pass
+EOF
+}
+
+mm_shutdown () {
+    if [ -x "/etc/init.d/mailman" ]; then
+        if [ -x /usr/sbin/invoke-rc.d ] ; then
+            invoke-rc.d mailman stop || true
+        else
+            /etc/init.d/mailman stop || true
+        fi
     fi
-  fi
-  chmod -x /var/lib/mailman/bin/mailmanctl
-fi
+}
+
+case $1 in
+    remove|upgrade)
+        mm_shutdown
+        unset_mm_templates
+        ;;
+    failed-upgrade|deconfigure)
+        ;;
+    *)
+        echo "${package}.prerm called with unknown argument $1" >&2
+        exit 1
+        ;;
+esac