[Pkg-mailman-hackers] Pkg-mailman commit - rev 120 - in branches/pkg-split/core/debian: . patches
Bernd S. Brentrup
bsb@haydn.debian.org
Fri, 07 May 2004 12:08:33 -0600
Author: bsb
Date: 2004-05-07 12:08:24 -0600 (Fri, 07 May 2004)
New Revision: 120
Added:
branches/pkg-split/core/debian/patches/52_check_perms.dpatch
Modified:
branches/pkg-split/core/debian/patches/00list
branches/pkg-split/core/debian/patches/40_FHS_dirs.dpatch
branches/pkg-split/core/debian/postinst
Log:
Fix directory permissions.
Modified: branches/pkg-split/core/debian/patches/00list
===================================================================
--- branches/pkg-split/core/debian/patches/00list 2004-05-07 17:58:02 UTC (rev 119)
+++ branches/pkg-split/core/debian/patches/00list 2004-05-07 18:08:24 UTC (rev 120)
@@ -16,7 +16,7 @@
50_README.EXIM.paths
50_README.POSTFIX
51_nocompile.pyc
-52_check_perms_lstat
+52_check_perms
53_disable_addons
55_options_traceback
56_fix_de_broken_links
Modified: branches/pkg-split/core/debian/patches/40_FHS_dirs.dpatch
===================================================================
--- branches/pkg-split/core/debian/patches/40_FHS_dirs.dpatch 2004-05-07 17:58:02 UTC (rev 119)
+++ branches/pkg-split/core/debian/patches/40_FHS_dirs.dpatch 2004-05-07 18:08:24 UTC (rev 120)
@@ -25,8 +25,8 @@
@DPATCH@
diff -urNad /debuild/mine/mailman/build-area/mailman-2.1.4/Mailman/Defaults.py.in mailman-2.1.4/Mailman/Defaults.py.in
---- /debuild/mine/mailman/build-area/mailman-2.1.4/Mailman/Defaults.py.in 2004-04-23 13:52:20.000000000 +0200
-+++ mailman-2.1.4/Mailman/Defaults.py.in 2004-04-23 13:54:46.000000000 +0200
+--- /debuild/mine/mailman/build-area/mailman-2.1.4/Mailman/Defaults.py.in 2004-05-06 21:24:46.000000000 +0200
++++ mailman-2.1.4/Mailman/Defaults.py.in 2004-05-06 21:26:55.000000000 +0200
@@ -1220,15 +1220,15 @@
# Useful directories
@@ -38,10 +38,12 @@
DATA_DIR = os.path.join(VAR_PREFIX, 'data')
SPAM_DIR = os.path.join(VAR_PREFIX, 'spam')
WRAPPER_DIR = os.path.join(EXEC_PREFIX, 'mail')
- BIN_DIR = os.path.join(PREFIX, 'bin')
- SCRIPTS_DIR = os.path.join(PREFIX, 'scripts')
+-BIN_DIR = os.path.join(PREFIX, 'bin')
+-SCRIPTS_DIR = os.path.join(PREFIX, 'scripts')
-TEMPLATE_DIR = os.path.join(PREFIX, 'templates')
-MESSAGES_DIR = os.path.join(PREFIX, 'messages')
++BIN_DIR = os.path.join(VAR_PREFIX, 'bin')
++SCRIPTS_DIR = os.path.join(VAR_PREFIX, 'scripts')
+TEMPLATE_DIR = '/etc/mailman/templates'
+MESSAGES_DIR = '/usr/share/locale'
PUBLIC_ARCHIVE_FILE_DIR = os.path.join(VAR_PREFIX, 'archives', 'public')
Copied: branches/pkg-split/core/debian/patches/52_check_perms.dpatch (from rev 104, branches/pkg-split/core/debian/patches/52_check_perms_lstat.dpatch)
===================================================================
--- branches/pkg-split/core/debian/patches/52_check_perms_lstat.dpatch 2004-05-02 14:58:34 UTC (rev 104)
+++ branches/pkg-split/core/debian/patches/52_check_perms.dpatch 2004-05-07 18:08:24 UTC (rev 120)
@@ -0,0 +1,117 @@
+#! /bin/sh -e
+## 52_check_perms.dpatch by Siggy Brentrup <bsb@debian.org>
+##
+## DP: Upstream check_perms wants all directories and files to be
+## DP: owned by group list with sgid set on directories. This is
+## DP: neither necessary for mailman to work correctly no acceptable
+## DP: for a Debian package.
+
+[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
+patch_opts="${patch_opts:--f --no-backup-if-mismatch ${2:+-d $2}}"
+
+if [ $# -lt 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch $patch_opts -p1 < $0;;
+ -unpatch) patch $patch_opts -p1 -R < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1;;
+esac
+
+exit 0
+@DPATCH@
+diff -urNad /debuild/mine/mailman/build-area/mailman-2.1.4/bin/check_perms mailman-2.1.4/bin/check_perms
+--- /debuild/mine/mailman/build-area/mailman-2.1.4/bin/check_perms 2004-05-07 11:44:37.000000000 +0200
++++ mailman-2.1.4/bin/check_perms 2004-05-07 11:58:11.000000000 +0200
+@@ -18,11 +18,11 @@
+
+ """Check the permissions for the Mailman installation.
+
+-Usage: %(PROGRAM)s [-f] [-v] [-h]
++Usage: %(PROGRAM)s [-f] [-v] [-q] [-h]
+
+ With no arguments, just check and report all the files that have bogus
+ permissions or group ownership. With -f (and run as root), fix all the
+-permission problems found. With -v be verbose.
++permission problems found. With -v be verbose, with -q suppress output.
+
+ """
+
+@@ -91,8 +91,7 @@
+ if seen.has_key(dirname):
+ return
+ seen[dirname] = True
+- for name in names:
+- path = os.path.join(dirname, name)
++ for path in [dirname]+[ os.path.join(dirname, name) for name in names]:
+ if arg.VERBOSE:
+ print _(' checking gid and mode for %(path)s')
+ try:
+@@ -157,14 +156,15 @@
+ else:
+ print
+
+-def checkall():
++def checkvar():
+ # first check PREFIX
+ if STATE.VERBOSE:
+ prefix = mm_cfg.PREFIX
+ print _('checking mode for %(prefix)s')
+ dirs = {}
+- for d in (mm_cfg.PREFIX, mm_cfg.EXEC_PREFIX, mm_cfg.VAR_PREFIX,
+- mm_cfg.LOG_DIR):
++ for d in (mm_cfg.LIST_DATA_DIR, mm_cfg.LOG_DIR, mm_cfg.LOCK_DIR,
++ mm_cfg.DATA_DIR, mm_cfg.SPAM_DIR, '/var/lib/mailman/archives',
++ mm_cfg.QUEUE_DIR, mm_cfg.MAILDIR_DIR, '/var/run/mailman'):
+ dirs[d] = True
+ for d in dirs.keys():
+ try:
+@@ -242,7 +242,7 @@
+ print
+
+ def checkcgi():
+- cgidir = os.path.join(mm_cfg.EXEC_PREFIX, 'cgi-bin')
++ cgidir = '/usr/lib/cgi-bin/mailman'
+ if STATE.VERBOSE:
+ print _('checking cgi-bin permissions')
+ exes = os.listdir(cgidir)
+@@ -346,8 +346,8 @@
+
+ if __name__ == '__main__':
+ try:
+- opts, args = getopt.getopt(sys.argv[1:], 'fvh',
+- ['fix', 'verbose', 'help'])
++ opts, args = getopt.getopt(sys.argv[1:], 'fvqh',
++ ['fix', 'verbose', 'quiet', 'help'])
+ except getopt.error, msg:
+ usage(1, msg)
+
+@@ -358,8 +358,10 @@
+ STATE.FIX = True
+ elif opt in ('-v', '--verbose'):
+ STATE.VERBOSE = True
++ elif opt in ('-q', '--quiet'):
++ sys.stdout = open('/dev/null', 'w')
+
+- checkall()
++ checkvar()
+ checkarchives()
+ checkarchivedbs()
+ checkcgi()
+@@ -368,8 +370,12 @@
+ checkadminpw()
+ checkmta()
+
++ sys.stdout = sys.__stdout__
++
+ if not STATE.ERRORS:
+ print _('No problems found')
+ else:
+ print _('Problems found:'), STATE.ERRORS
+- print _('Re-run as %(MAILMAN_USER)s (or root) with -f flag to fix')
++ print _('Re-run as root with -f flag to fix')
++else:
++ print __name__
Property changes on: branches/pkg-split/core/debian/patches/52_check_perms.dpatch
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id URL
Modified: branches/pkg-split/core/debian/postinst
===================================================================
--- branches/pkg-split/core/debian/postinst 2004-05-07 17:58:02 UTC (rev 119)
+++ branches/pkg-split/core/debian/postinst 2004-05-07 18:08:24 UTC (rev 120)
@@ -207,37 +207,42 @@
def fix_perms():
"""Fix directory permissions to allow write access to group list.
"""#
- from stat import S_IMODE, S_ISGID, S_IRWXG
+ log('Fixing permissions ...', nl='', lvl=2)
+ check_perms = os.path.join(MM_BIN, 'check_perms')
+ rc = CommandRunner(MM_BIN).run(check_perms, '-f', '-q')
+ if rc:
+ log(' done, rc=%r.' % rc, lvl=2)
+ else:
+ log(' done.', lvl=2)
+ return rc
- from Mailman.Defaults import LIST_DATA_DIR, LOG_DIR, LOCK_DIR, \
- DATA_DIR, SPAM_DIR, PUBLIC_ARCHIVE_FILE_DIR, PRIVATE_ARCHIVE_FILE_DIR, \
- QUEUE_DIR, INQUEUE_DIR, OUTQUEUE_DIR, CMDQUEUE_DIR, BOUNCEQUEUE_DIR, \
- NEWSQUEUE_DIR, ARCHQUEUE_DIR, SHUNTQUEUE_DIR, VIRGINQUEUE_DIR, \
- BADQUEUE_DIR, RETRYQUEUE_DIR, MAILDIR_DIR
- import grp
- gid = grp.getgrnam('list')[2]
+def update_lists():
+ """Update mailing list configurations.
+ """#
+ log('Updating existing mailing lists ...', nl='', lvl=2)
+ update = os.path.join(MM_BIN, 'update')
+ rc = CommandRunner(MM_BIN).run(update)
+ if rc:
+ log(' done, rc=%r.' % rc, lvl=2)
+ else:
+ log(' done.', lvl=2)
+ return rc
- for dir_ in (LIST_DATA_DIR, LOG_DIR, LOCK_DIR, DATA_DIR, SPAM_DIR,
- PUBLIC_ARCHIVE_FILE_DIR, PRIVATE_ARCHIVE_FILE_DIR,
- QUEUE_DIR, INQUEUE_DIR, OUTQUEUE_DIR, CMDQUEUE_DIR,
- BOUNCEQUEUE_DIR, NEWSQUEUE_DIR, ARCHQUEUE_DIR,
- SHUNTQUEUE_DIR, VIRGINQUEUE_DIR, BADQUEUE_DIR,
- RETRYQUEUE_DIR, MAILDIR_DIR,):
- stt = os.stat(dir_)
- if stt.st_gid != gid:
- os.chown(dir_, stt.st_uid, gid)
- if (stt.st_mode & (S_ISGID|S_IRWXG)) != (S_ISGID|S_IRWXG):
- os.chmod(dir_, S_IMODE(stt.st_mode) | S_ISGID | S_IRWXG)
-
def run_debhelper_additions():
+ from Mailman import mm_cfg
+ help = os.path.join(mm_cfg.TEMPLATE_DIR,
+ mm_cfg.DEFAULT_SERVER_LANGUAGE,
+ 'help.txt')
+ log(os.path.isfile(help) and 'Will start daemon.'
+ or 'Will not start daemon.', lvl=2)
+ enabled = os.path.isfile(help) and '+x' or '-x'
from popen2 import Popen4
runner = Popen4('/bin/sh -e')
runner.tochild.write("""\
-sg list -c "umask 002; /var/lib/mailman/bin/update;"
-
-#DEBHELPER#""")
+chmod %s /var/lib/mailman/bin/mailmanctl
+#DEBHELPER#""" % enabled)
runner.tochild.close()
while True:
rc = runner.poll()
@@ -253,6 +258,7 @@
ucf_to_cfdb()
create_mm_cfg()
update_cron()
+ update_lists()
fix_perms()
run_debhelper_additions()