You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.7 KiB

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