root/alternc-mailman/tags/1.5/debian/postinst

Revision 1773, 3.0 kB (checked in by anarcat, 2 years ago)

add an apache configuration for alternc-mailman instead of hacking the httpd.conf. we now use the standard images/mailman and pipermail aliases for mailman (/pipermail and /images/mailman)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/bin/sh
2
3 set -e
4
5 CONFIGFILE="/etc/alternc/local.sh"
6 MENUFILE="/etc/alternc/menulist.txt"
7 MAILMAN_SCRIPT="/var/lib/mailman/mail/mailman"
8 MAILMAN_CONFIG="/etc/mailman/mm_cfg.py"
9 MAILMAN_CONFIG_TEMPLATE="/etc/alternc/templates/mailman/mm_cfg.py"
10 MAILMAN_CONFIG_BACKUP="/var/backups/alternc/etc-mailman-mm_cfg.py"
11 MAILMAN_SCRIPT="/var/lib/mailman/mail/mailman"
12
13 case "$1" in
14   configure)
15     . "$CONFIGFILE"
16
17     echo "Installing mysql table"
18     mysql -u"$MYSQL_USER" -p"$MYSQL_PASS" -h"$MYSQL_HOST" "$MYSQL_DATABASE" \
19         < /usr/share/alternc/install/mailman.sql
20    
21     # Install generated mailman configuration if it has not been modified since
22     # last package configuration
23     if [ -f "$MAILMAN_CONFIG_BACKUP" ]; then
24         if ! diff -q "$MAILMAN_CONFIG" "$MAILMAN_CONFIG_BACKUP"; then
25             echo "$MAILMAN_CONFIG has been modified since last alternc-mailman"
26             echo "configuration.  You should merge your changes to"
27             echo "$MAILMAN_CONFIG_TEMPLATE and delete $MAILMAN_CONFIG_BACKUP"
28             exit 1
29         fi
30     fi
31     sed -e "s/%%fqdn%%/$FQDN/" < "$MAILMAN_CONFIG_TEMPLATE" > "$MAILMAN_CONFIG"
32     cp -a -f "$MAILMAN_CONFIG" "$MAILMAN_CONFIG_BACKUP"
33
34     # Create the "mailman" list if it does not exist yet
35     if [ ! -d /var/lib/mailman/lists/mailman ]; then
36         /var/lib/mailman/bin/newlist -q mailman "root@$FQDN" "$MYSQL_PASS"
37         ( echo "INSERT INTO mailman SET
38                 id=NULL, uid=2000, list='mailman', domain='${FQDN}', name='mailman';"
39           echo "INSERT INTO mail_domain SET
40                 mail='mailman@${FQDN}', alias='mailman_${FQDN}', uid=2000, pop=0, type=1;"
41           echo "INSERT INTO mail_alias SET
42                 mail='mailman_${FQDN}', alias='\"| $MAILMAN_SCRIPT post mailman\"';"
43           for kind in request owner admin bounces confirm join \
44                       leave subscribe unsubscribe; do
45               echo "INSERT INTO mail_domain SET
46                     mail='mailman-${kind}@${FQDN}', alias='mailman-${kind}_${FQDN}', uid=2000, pop=0, type=1;"
47               echo "INSERT INTO mail_alias SET
48                     mail='mailman-${kind}_${FQDN}', alias='\"| $MAILMAN_SCRIPT ${kind} mailman\"');"
49           done
50         ) | mysql -f -u"$MYSQL_USER" -p"$MYSQL_PASS" -h"$MYSQL_HOST" \
51               "$MYSQL_DATABASE" || true
52     fi
53
54     ln -sf /usr/lib/cgi-bin/mailman /var/alternc/cgi-bin/mailman
55     alternc.install
56
57     # Process the language compilation.
58     /usr/share/alternc/install/dopo.sh
59
60     # ADD Mailman menu item :
61     if ! grep -q "^menu_mailman.php$" "$MENUFILE"; then
62         rm -f $MENUFILE.alternc_mailman
63         sed -e "s/menu_ftp.php/&\\
64 menu_mailman.php/" <$MENUFILE >$MENUFILE.alternc_mailman
65         mv -f $MENUFILE.alternc_mailman $MENUFILE
66     fi
67     ;;
68
69   abort-upgrade|abort-remove|abort-deconfigure)
70     ;;
71
72   *)
73     echo "postinst called with unknown argument \`$1'" >&2
74     exit 1
75     ;;
76 esac
77
78 # dh_installdeb will replace this with shell code automatically
79 # generated by other debhelper scripts.
80 #DEBHELPER#
81
82 # vim: et sw=4
83
Note: See TracBrowser for help on using the browser.