2 # Copyright (C) 2014 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
12 PKG_SOURCE_URL
:=ftp
://ftp.gnu.org
/gnu
/mailman
/ http
://ftp.gnu.org
/gnu
/mailman
/
14 PKG_MD5SUM
:=dc861ed9698a98499a951eaef7d4db9f
15 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).tgz
16 PKG_MAINTAINER
:=Denis Shulyaka
<Shulyaka@gmail.com
>
18 PKG_LICENSE_FILES
:=gnu-COPYING-GPL
20 include $(INCLUDE_DIR
)/package.mk
22 define Package
/mailman
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
30 define Package
/mailman
/description
31 Mailman is free software for managing electronic mail discussion and e-newsletter lists.
34 prefix=/usr
/local
/mailman
36 define Package
/mailman
/conffiles
37 $(prefix)/Mailman
/mm_cfg.py
41 --prefix="$(prefix)" \
42 --exec-prefix
="$(prefix)" \
43 --with-username
="root" \
44 --with-groupname
="root" \
45 --with-mail-gid
="nogroup" \
46 --with-cgi-gid
="root" \
52 define Package
/mailman
/install
53 $(INSTALL_DIR
) $(1)$(prefix)
54 cd
$(PKG_BUILD_DIR
); $(MAKE
) DESTDIR
=$(1) install
55 $(INSTALL_DIR
) $(1)/etc
/init.d
56 $(INSTALL_BIN
) .
/files
/mailman.init
$(1)/etc
/init.d
/mailman
57 $(INSTALL_DIR
) $(1)/usr
/www
58 ln
-s
$(prefix)/cgi-bin
/ $(1)/usr
/www
/mailman
59 ln
-s
$(prefix)/archives
/public
/ $(1)/usr
/www
/pipermail
60 ln
-s
$(prefix)/icons
$(1)/usr
/www
/icons
63 define Package
/mailman
/postinst
65 # check if we are on real system
66 if
[ -z
"$${IPKG_INSTROOT}" ]; then
68 if
[ `postconf alias_maps | grep -ci mailman` -eq
0 ]
70 postconf
-e
"`postconf alias_maps`, cdb:$(prefix)/data/aliases"
73 hostname
=`cat /proc/sys/kernel/hostname`
74 if
[ ! -f data
/aliases
]
79 if
[ `grep -c DEFAULT_URL_HOST Mailman/mm_cfg.py` -eq
0 ]
81 echo
"DEFAULT_EMAIL_HOST = '$$hostname'" >> Mailman
/mm_cfg.py
82 echo
"DEFAULT_URL_HOST = '$$hostname'" >> Mailman
/mm_cfg.py
83 echo
"add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)" >> Mailman
/mm_cfg.py
84 echo
"QRUNNERS.remove(('NewsRunner',1))" >> Mailman
/mm_cfg.py
86 if
[ `./bin/list_lists | grep -ci mailman` -eq
0 ]
88 .
/bin
/newlist
--urlhost
=$$hostname --emailhost
=$$hostname --quiet mailman root@
$$hostname mailman
89 .
/bin
/config_list
-i data
/sitelist.cfg mailman
90 echo
"NOTE: A default site-wide mailing list Mailman with password 'mailman' has been created. Please review it and change the password."
91 .
/bin
/mmsitepass mailman
92 echo
"NOTE: The default site password 'mailman' has been created."
94 # /etc/init.d/mailman enable
95 if
[ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt
0 ]
97 $(prefix)/bin
/mailmanctl
-q restart
99 if
[ `grep -c mailman /etc/config/uhttpd` -eq
0 ]
100 then
#we assume that the server is not configured yet, thus print out some help for the first time:
101 echo
"NOTE: Please set the site password using $(prefix)/bin/mmsitepass <your-site-password>"
102 echo
"Please add uhttpd config section to your /etc/config/uhttpd like this:"
103 echo
"config uhttpd mailman"
104 echo
" list listen_http 0.0.0.0:80"
105 echo
" option home /usr/www"
106 echo
" option cgi_prefix /mailman"
107 echo
" no_symlinks 0"
108 echo
"Don't forget to setup firewall for accessing this website!"
109 echo
"To add a mailing list go to http://$$hostname/mailman/create."
114 define Package
/mailman
/prerm
116 # check if we are on real system
117 if
[ -z
"$${IPKG_INSTROOT}" ]; then
119 if
[ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt
0 ]
121 $(prefix)/bin
/mailmanctl stop
126 $(eval
$(call BuildPackage
,mailman
))