Makefile (3789B)
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/ http://ftp.gnu.org/gnu/mailman/ 13 PKG_VERSION:=2.1.23 14 PKG_MD5SUM:=ceb2d8427e29f4e69b2505423ffeb60b 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_FILES:=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 +uhttpd +python-dns 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-username="root" \ 44 --with-groupname="root" \ 45 --with-mail-gid="nogroup" \ 46 --with-cgi-gid="root" \ 47 --without-permcheck \ 48 49 define Build/Compile 50 endef 51 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 61 endef 62 63 define Package/mailman/postinst 64 #!/bin/sh 65 # check if we are on real system 66 if [ -z "$${IPKG_INSTROOT}" ]; then 67 68 if [ `postconf alias_maps | grep -ci mailman` -eq 0 ] 69 then 70 postconf -e "`postconf alias_maps`, cdb:$(prefix)/data/aliases" 71 fi 72 cd $(prefix) 73 hostname=`cat /proc/sys/kernel/hostname` 74 if [ ! -f data/aliases ] 75 then 76 ./bin/genaliases 77 fi 78 newaliases 79 if [ `grep -c DEFAULT_URL_HOST Mailman/mm_cfg.py` -eq 0 ] 80 then 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 85 fi 86 if [ `./bin/list_lists | grep -ci mailman` -eq 0 ] 87 then 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." 93 fi 94 # /etc/init.d/mailman enable 95 if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ] 96 then 97 $(prefix)/bin/mailmanctl -q restart 98 fi 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." 110 fi 111 fi 112 endef 113 114 define Package/mailman/prerm 115 #!/bin/sh 116 # check if we are on real system 117 if [ -z "$${IPKG_INSTROOT}" ]; then 118 119 if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ] 120 then 121 $(prefix)/bin/mailmanctl stop 122 fi 123 fi 124 endef 125 126 $(eval $(call BuildPackage,mailman))