[Mailman-Developers] QMail Patch

Sean Reifschneider jafo@tummy.com
Mon, 30 Aug 1999 09:05:50 -0600


Here's a patch for Defaults.py which adds a variable named "MTA", and
sets it to "qmail" if the directory /var/qmail exists.  Also included
is a patch to newlist which if MTA is set to "qmail" displays the
commands required to create the specified aliases using the
"~alias/.qmail" method.

I'm not really happy with all the "SM*" keys added to the dict, but I
think that the goal of making the sendmail aliases prettier is a good
one...  Maybe it would make more sense to remove the SM* ones and
have a set of routines for each MTA like:

   def display_aliases_qmail(dict):
      print 'whatever'

   def display_aliases_sendmail(dict):
      for key in ( 'admin', 'owner1', 'owner2', 'list' ):
         dict[key] = '%-24s' % ( dict[key] + ':' )
      print 'whatever'

   def display_aliases_default(dict):
      print "Don't know how to set up aliases for your MTA."
      print
      print "You will have to manually set up aliases for the following"
      print "addresses:"
      print
      [...]

   [...]
   try:
      eval('display_aliases_%s(dict)' % mm_cfg.MTA)
   except NameError:
      display_aliases_default(dict)

Sean

=============================================
*** bin/newlist.orig Mon Aug 30 08:43:32 1999
--- bin/newlist   Sun Aug 29 18:45:01 1999
***************
*** 98,122 ****
          sys.exit(1)
  
      ###os.system('%s %s' % (ADDALIASES_CMD, list_name))
!     print '''
  Entry for aliases file:
  
  ## %(listname)s mailing list
  ## created: %(date)s %(user)s
! %(list)s "|%(wrapper)s post %(listname)s"
! %(admin)s "|%(wrapper)s mailowner %(listname)s"
! %(request)s "|%(wrapper)s mailcmd %(listname)s"
! %(owner1)s %(listname)s-admin
! %(owner2)s %(listname)s-admin
! ''' % {'listname': list_name,
!        'list'    : "%-24s" % (list_name + ":"),
!        'wrapper' : '%s/wrapper' % mm_cfg.WRAPPER_DIR,
!        'admin'   : "%-24s" % ("%s-admin:" % list_name),
!        'request' : "%-24s" % ("%s-request:" % list_name),
!        'owner1'  : "%-24s" % ("owner-%s:" % list_name),
!        'owner2'  : "%-24s" % ("%s-owner:" % list_name),
!        'date'    : time.strftime('%d-%b-%Y', time.localtime(time.time())),
!        'user'    : getusername(),
         }
  
      if len(argv) < 5:
--- 98,144 ----
          sys.exit(1)
  
      ###os.system('%s %s' % (ADDALIASES_CMD, list_name))
!     print '%s %s' % (ADDALIASES_CMD, list_name)
! 
!     if mm_cfg.MTA == 'qmail':
!         aliases = '''
! To create system aliases:
! 
! echo '|%(wrapper)s post %(listname)s' >~alias/.qmail-%(list)s
! echo '|%(wrapper)s mailowner %(listname)s' >~alias/.qmail-%(admin)s
! echo '|%(wrapper)s mailcmd %(listname)s' >~alias/.qmail-%(request)s
! echo '&%(listname)s-admin' >~alias/.qmail-%(owner1)s
! echo '&%(listname)s-admin' >~alias/.qmail-%(owner2)s
! chmod 644 ~alias/.qmail-%(list)s ~alias/.qmail-%(admin)s
! chmod 644 ~alias/.qmail-%(request)s ~alias/.qmail-%(owner1)s
! chmod 644 ~alias/.qmail-%(owner2)s
! '''
!     else:
!         aliases = '''
  Entry for aliases file:
  
  ## %(listname)s mailing list
  ## created: %(date)s %(user)s
! %(SMlist)s "|%(wrapper)s post %(listname)s"
! %(SMadmin)s "|%(wrapper)s mailowner %(listname)s"
! %(SMrequest)s "|%(wrapper)s mailcmd %(listname)s"
! %(SMowner1)s %(listname)s-admin
! %(SMowner2)s %(listname)s-admin
! '''
!     print aliases % {'listname': list_name,
!        'list'      : list_name,
!        'SMlist'    : "%-24s" % (list_name + ":"),
!        'wrapper'   : '%s/wrapper' % mm_cfg.WRAPPER_DIR,
!        'admin'     : "%s-admin" % list_name,
!        'SMadmin'   : "%-24s" % ("%s-admin:" % list_name),
!        'request'   : "%s-request" % list_name,
!        'SMrequest' : "%-24s" % ("%s-request:" % list_name),
!        'owner1'    : "owner-%s" % list_name,
!        'SMowner1'  : "%-24s" % ("owner-%s:" % list_name),
!        'owner2'    : "%s-owner" % list_name,
!        'SMowner2'  : "%-24s" % ("%s-owner:" % list_name),
!        'date'      : time.strftime('%d-%b-%Y', time.localtime(time.time())),
!        'user'      : getusername(),
         }
  
      if len(argv) < 5:
*** Mailman/Defaults.py.orig  Sun Aug 29 18:17:13 1999
--- Mailman/Defaults.py Sun Aug 29 18:22:49 1999
***************
*** 300,307 ****
  PUBLIC_ARCHIVE_FILE_DIR  = os.path.join(PREFIX, 'archives/public')
  PRIVATE_ARCHIVE_FILE_DIR = os.path.join(PREFIX, 'archives/private')
  
  # The Mailman version, also set by configure
  VERSION           = "1.0"
  
  # Data file version number
! DATA_FILE_VERSION = 15
--- 300,313 ----
  PUBLIC_ARCHIVE_FILE_DIR  = os.path.join(PREFIX, 'archives/public')
  PRIVATE_ARCHIVE_FILE_DIR = os.path.join(PREFIX, 'archives/private')
  
+ #  autodetect MTA being used, can be overridden in config file.
+ if os.path.isdir(os.path.join('/var', 'qmail')):
+  MTA = 'qmail'
+ else:
+  MTA = 'sendmail'
+ 
  # The Mailman version, also set by configure
  VERSION           = "1.0"
  
  # Data file version number
! DATA_FILE_VERSION = 16
-- 
 A smart terminal is not a smart*ass* terminal, but rather a terminal
 you can educate.  -- Rob Pike
Sean Reifschneider, Inimitably Superfluous <jafo@tummy.com>
URL: <http://www.tummy.com/xvscan> HP-UX/Linux/FreeBSD/BSDOS scanning software.