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.

124 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/
  11. PKG_VERSION:=2.1.18-1
  12. PKG_MD5SUM:=dc861ed9698a98499a951eaef7d4db9f
  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_FILE:=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-mini +uhttpd +python-dns #+python-dev
  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-python="/usr/bin/python" \
  36. --with-username="root" \
  37. --with-groupname="root" \
  38. --with-mail-gid="nogroup" \
  39. --with-cgi-gid="root" \
  40. --without-permcheck \
  41. define Package/mailman/install
  42. $(INSTALL_DIR) $(1)$(prefix)
  43. cd $(PKG_BUILD_DIR); $(MAKE) DESTDIR=$(1) install
  44. $(INSTALL_DIR) $(1)/etc/init.d
  45. $(INSTALL_BIN) ./files/mailman.init $(1)/etc/init.d/mailman
  46. $(INSTALL_DIR) $(1)/usr/www
  47. ln -s $(prefix)/cgi-bin/ $(1)/usr/www/mailman
  48. ln -s $(prefix)/archives/public/ $(1)/usr/www/pipermail
  49. ln -s $(prefix)/icons $(1)/usr/www/icons
  50. endef
  51. define Package/mailman/postinst
  52. #!/bin/sh
  53. # check if we are on real system
  54. if [ -z "$${IPKG_INSTROOT}" ]; then
  55. if [ `postconf alias_maps | grep -ci mailman` -eq 0 ]
  56. then
  57. postconf -e "`postconf alias_maps`, cdb:$(prefix)/data/aliases"
  58. fi
  59. cd $(prefix)
  60. hostname=`cat /proc/sys/kernel/hostname`
  61. if [ ! -f data/aliases ]
  62. then
  63. ./bin/genaliases
  64. fi
  65. newaliases
  66. if [ `grep -c DEFAULT_URL_HOST Mailman/mm_cfg.py` -eq 0 ]
  67. then
  68. echo "DEFAULT_EMAIL_HOST = '$$hostname'" >> Mailman/mm_cfg.py
  69. echo "DEFAULT_URL_HOST = '$$hostname'" >> Mailman/mm_cfg.py
  70. echo "add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)" >> Mailman/mm_cfg.py
  71. echo "QRUNNERS.remove(('NewsRunner',1))" >> Mailman/mm_cfg.py
  72. fi
  73. if [ `./bin/list_lists | grep -ci mailman` -eq 0 ]
  74. then
  75. ./bin/newlist --urlhost=$$hostname --emailhost=$$hostname --quiet mailman root@$$hostname mailman
  76. ./bin/config_list -i data/sitelist.cfg mailman
  77. echo "NOTE: A default site-wide mailing list Mailman with password 'mailman' has been created. Please review it and change the password."
  78. ./bin/mmsitepass mailman
  79. echo "NOTE: The default site password 'mailman' has been created."
  80. fi
  81. if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ]
  82. then
  83. $(prefix)/bin/mailmanctl -q restart
  84. fi
  85. if [ `grep -c mailman /etc/config/uhttpd` -eq 0 ]
  86. then #we assume that the server is not configured yet, thus print out some help for the first time:
  87. echo "NOTE: Please set the site password using $(prefix)/bin/mmsitepass <your-site-password>"
  88. echo "Please add uhttpd config section to your /etc/config/uhttpd like this:"
  89. echo "config uhttpd mailman"
  90. echo " list listen_http 0.0.0.0:80"
  91. echo " option home /usr/www"
  92. echo " option cgi_prefix /mailman"
  93. echo " no_symlinks 0"
  94. echo "Don't forget to setup firewall for accessing this website!"
  95. echo "To add a mailing list go to http://$$hostname/mailman/create."
  96. fi
  97. # /etc/init.d/mailman enable
  98. fi
  99. endef
  100. define Package/mailman/prerm
  101. #!/bin/sh
  102. # check if we are on real system
  103. if [ -z "$${IPKG_INSTROOT}" ]; then
  104. if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ]
  105. then
  106. $(prefix)/bin/mailmanctl stop
  107. fi
  108. fi
  109. endef
  110. $(eval $(call BuildPackage,mailman))