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.

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