Browse Source

Merge pull request #473 from Shulyaka/mailman

mailman: New mailman package (mailing list manager)
sbyx 10 years ago
parent
commit
fb384f9db5

+ 124
- 0
mail/mailman/Makefile View File

@@ -0,0 +1,124 @@
1
+# 
2
+# Copyright (C) 2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=mailman
11
+PKG_RELEASE:=1
12
+PKG_SOURCE_URL:=ftp://ftp.gnu.org/gnu/mailman/
13
+PKG_VERSION:=2.1.18-1
14
+PKG_MD5SUM:=dc861ed9698a98499a951eaef7d4db9f
15
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
16
+PKG_MAINTAINER:=Denis Shulyaka <Shulyaka@gmail.com>
17
+PKG_LICENSE:=GPL-2.0+
18
+PKG_LICENSE_FILE:=gnu-COPYING-GPL
19
+
20
+include $(INCLUDE_DIR)/package.mk
21
+
22
+define Package/mailman
23
+  SECTION:=mail
24
+  CATEGORY:=Mail
25
+  TITLE:=The GNU Mailing List Manager
26
+  URL:=http://www.gnu.org/software/mailman/
27
+  DEPENDS:=+postfix +python-mini +uhttpd +python-dns #+python-dev
28
+endef
29
+
30
+define Package/mailman/description
31
+ Mailman is free software for managing electronic mail discussion and e-newsletter lists.
32
+endef
33
+
34
+prefix=/usr/local/mailman
35
+
36
+define Package/mailman/conffiles
37
+$(prefix)/Mailman/mm_cfg.py
38
+endef
39
+
40
+CONFIGURE_ARGS += \
41
+	--prefix="$(prefix)" \
42
+	--exec-prefix="$(prefix)" \
43
+	--with-python="/usr/bin/python" \
44
+	--with-username="root" \
45
+	--with-groupname="root" \
46
+	--with-mail-gid="nogroup" \
47
+	--with-cgi-gid="root" \
48
+	--without-permcheck \
49
+
50
+define Package/mailman/install
51
+	$(INSTALL_DIR) $(1)$(prefix)
52
+	cd $(PKG_BUILD_DIR); $(MAKE) DESTDIR=$(1) install
53
+	$(INSTALL_DIR) $(1)/etc/init.d
54
+	$(INSTALL_BIN) ./files/mailman.init $(1)/etc/init.d/mailman
55
+	$(INSTALL_DIR) $(1)/usr/www
56
+	ln -s $(prefix)/cgi-bin/ $(1)/usr/www/mailman
57
+	ln -s $(prefix)/archives/public/ $(1)/usr/www/pipermail
58
+	ln -s $(prefix)/icons $(1)/usr/www/icons
59
+endef
60
+
61
+define Package/mailman/postinst
62
+#!/bin/sh
63
+# check if we are on real system
64
+if [ -z "$${IPKG_INSTROOT}" ]; then
65
+
66
+ if [ `postconf alias_maps | grep -ci mailman` -eq 0 ]
67
+ then
68
+  postconf -e "`postconf alias_maps`, cdb:$(prefix)/data/aliases"
69
+ fi
70
+ cd $(prefix)
71
+ hostname=`cat /proc/sys/kernel/hostname`
72
+ if [ ! -f data/aliases ]
73
+ then
74
+  ./bin/genaliases
75
+ fi
76
+ newaliases
77
+ if [ `grep -c DEFAULT_URL_HOST Mailman/mm_cfg.py` -eq 0 ]
78
+ then
79
+  echo "DEFAULT_EMAIL_HOST = '$$hostname'" >> Mailman/mm_cfg.py
80
+  echo "DEFAULT_URL_HOST = '$$hostname'" >> Mailman/mm_cfg.py
81
+  echo "add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)" >> Mailman/mm_cfg.py
82
+  echo "QRUNNERS.remove(('NewsRunner',1))" >> Mailman/mm_cfg.py
83
+ fi
84
+ if [ `./bin/list_lists | grep -ci mailman` -eq 0 ]
85
+ then
86
+  ./bin/newlist --urlhost=$$hostname --emailhost=$$hostname --quiet mailman root@$$hostname mailman
87
+  ./bin/config_list -i data/sitelist.cfg mailman
88
+  echo "NOTE: A default site-wide mailing list Mailman with password 'mailman' has been created. Please review it and change the password."
89
+  ./bin/mmsitepass mailman
90
+  echo "NOTE: The default site password 'mailman' has been created."
91
+ fi
92
+ if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ]
93
+ then
94
+  $(prefix)/bin/mailmanctl -q restart
95
+ fi
96
+ if [ `grep -c mailman /etc/config/uhttpd` -eq 0 ]
97
+ then #we assume that the server is not configured yet, thus print out some help for the first time:
98
+  echo "NOTE: Please set the site password using $(prefix)/bin/mmsitepass <your-site-password>"
99
+  echo "Please add uhttpd config section to your /etc/config/uhttpd like this:"
100
+  echo "config uhttpd mailman"
101
+  echo "	list listen_http	0.0.0.0:80"
102
+  echo "	option home		/usr/www"
103
+  echo "	option cgi_prefix	/mailman"
104
+  echo "	no_symlinks		0"
105
+  echo "Don't forget to setup firewall for accessing this website!"
106
+  echo "To add a mailing list go to http://$$hostname/mailman/create."
107
+ fi
108
+ # /etc/init.d/mailman enable
109
+fi
110
+endef
111
+
112
+define Package/mailman/prerm
113
+#!/bin/sh
114
+# check if we are on real system
115
+if [ -z "$${IPKG_INSTROOT}" ]; then
116
+
117
+ if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ]
118
+ then
119
+  $(prefix)/bin/mailmanctl stop
120
+ fi
121
+fi
122
+endef
123
+
124
+$(eval $(call BuildPackage,mailman))

+ 22
- 0
mail/mailman/files/mailman.init View File

@@ -0,0 +1,22 @@
1
+#!/bin/sh /etc/rc.common
2
+# Copyright (C) 2014 OpenWrt.org
3
+
4
+START=50
5
+STOP=50
6
+
7
+PYTHON=/usr/bin/python
8
+MAILMANHOME=/usr/local/mailman
9
+MAILMANCTL=$MAILMANHOME/bin/mailmanctl
10
+
11
+start() {
12
+	#rm -f $MAILMANHOME/locks/*
13
+	$PYTHON $MAILMANCTL -s -q start
14
+}
15
+
16
+stop() {
17
+	$PYTHON $MAILMANCTL -q stop
18
+}
19
+
20
+restart() {
21
+	$PYTHON $MAILMANCTL -q restart
22
+}

+ 12
- 0
mail/mailman/patches/100-postfix.patch View File

@@ -0,0 +1,12 @@
1
+diff -rupN mailman-2.1.14-1/Mailman/Defaults.py.in mailman-2.1.14-1_patched/Mailman/Defaults.py.in
2
+--- mailman-2.1.14-1/Mailman/Defaults.py.in	2011-03-01 23:35:57.000000000 +0300
3
++++ mailman-2.1.14-1_patched/Mailman/Defaults.py.in	2011-03-09 12:26:10.000000000 +0300
4
+@@ -439,7 +439,7 @@ DELIVERY_MODULE = 'SMTPDirect'
5
+ # standard out (or send an email to the site list owner) for manual twiddling
6
+ # of an /etc/aliases style file.  Use 'Postfix' if you are using the Postfix
7
+ # MTA -- but then also see POSTFIX_STYLE_VIRTUAL_DOMAINS.
8
+-MTA = 'Manual'
9
++MTA = 'Postfix'
10
+ 
11
+ # If you set MTA='Postfix', then you also want to set the following variable,
12
+ # depending on whether you're using virtual domains in Postfix, and which

+ 68
- 0
mail/mailman/patches/200-nohostdnspython.patch View File

@@ -0,0 +1,68 @@
1
+diff -Naur mailman-2.1.18-1/configure mailman-2.1.18-1_patched/configure
2
+--- mailman-2.1.18-1/configure	2014-10-26 12:00:38.090360119 +0300
3
++++ mailman-2.1.18-1_patched/configure	2014-10-26 12:00:21.323016430 +0300
4
+@@ -2236,35 +2236,35 @@
5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version" >&5
6
+ $as_echo "$version" >&6; }
7
+ 
8
+-# See if dnspython is installed.
9
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dnspython" >&5
10
+-$as_echo_n "checking dnspython... " >&6; }
11
+-
12
+-cat > conftest.py <<EOF
13
+-try:
14
+-    import dns.resolver
15
+-    res = 'ok'
16
+-except ImportError:
17
+-    res = 'no'
18
+-fp = open("conftest.out", "w")
19
+-fp.write("%s\n" % res)
20
+-fp.close()
21
+-EOF
22
+-
23
+-$PYTHON conftest.py
24
+-havednspython=`cat conftest.out`
25
+-rm -f conftest.out conftest.py
26
+-if test "$havednspython" = "no"
27
+-then
28
+-    as_fn_error $? "
29
+-
30
+-***** dnspython not found. It is required for the new
31
+-***** dmarc_moderation_action featurer. Get it from
32
+-***** <http://www.dnspython.org/> or
33
+-***** <https://pypi.python.org/pypi/dnspython/>" "$LINENO" 5
34
+-fi
35
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $havednspython" >&5
36
+-$as_echo "$havednspython" >&6; }
37
++## See if dnspython is installed.
38
++#{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dnspython" >&5
39
++#$as_echo_n "checking dnspython... " >&6; }
40
++#
41
++#cat > conftest.py <<EOF
42
++#try:
43
++#    import dns.resolver
44
++#    res = 'ok'
45
++#except ImportError:
46
++#    res = 'no'
47
++#fp = open("conftest.out", "w")
48
++#fp.write("%s\n" % res)
49
++#fp.close()
50
++#EOF
51
++#
52
++#$PYTHON conftest.py
53
++#havednspython=`cat conftest.out`
54
++#rm -f conftest.out conftest.py
55
++#if test "$havednspython" = "no"
56
++#then
57
++#    as_fn_error $? "
58
++#
59
++#***** dnspython not found. It is required for the new
60
++#***** dmarc_moderation_action featurer. Get it from
61
++#***** <http://www.dnspython.org/> or
62
++#***** <https://pypi.python.org/pypi/dnspython/>" "$LINENO" 5
63
++#fi
64
++#{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $havednspython" >&5
65
++#$as_echo "$havednspython" >&6; }
66
+ 
67
+ # Check the email package version.
68
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python's email package" >&5