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.

141 lines
4.6 KiB

  1. #
  2. # Copyright (C) 2009 David Cooper <dave@kupesoft.com>
  3. # Copyright (C) 2009-2015 OpenWrt.org
  4. # Copyright (C) 2016 Daniel Dickinson <lede@daniel.thecshore.com>
  5. #
  6. # This is free software, licensed under the GNU General Public License v2.
  7. # See /LICENSE for more information.
  8. #
  9. include $(TOPDIR)/rules.mk
  10. PKG_NAME:=msmtp-scripts
  11. PKG_VERSION:=1.0.8
  12. PKG_RELEASE:=1
  13. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  14. PKG_SOURCE_URL:=@SF/msmtp-scripts
  15. PKG_MD5SUM:=2aec48d47b02facf2a33cf97a7434e969c1a054224406e6c55320d825c7902b2
  16. PKG_LICENSE:=GPL-3.0+
  17. PKG_LICENSE_FILES:=COPYING
  18. PKG_MAINTAINER:=Daniel Dickinson <lede@daniel.thecshore.com>
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/msmtp-scripts/Default
  21. SECTION:=mail
  22. CATEGORY:=Mail
  23. TITLE:=Simple sendmail SMTP queueing and forwarding
  24. URL:=http://msmtp-scripts.sourceforge.net/
  25. endef
  26. define Package/msmtp-scripts/Default/description
  27. msmtp-scripts are scripts wrappers around the msmtp SMTP client that
  28. add queueing, logging to syslog or file, a subset of sendmail/postfix
  29. mailq/postsuper/postqueue commands implemented in a compatible fashion.
  30. endef
  31. define Package/msmtpq-ng
  32. $(call Package/msmtp-scripts/Default)
  33. DEPENDS+= @(PACKAGE_msmtp||PACKAGE_msmtp-nossl)
  34. TITLE+= (msmtpq-ng wrappers)
  35. endef
  36. define Package/msmtpq-ng/conffiles
  37. /etc/msmtpq-ng.rc
  38. endef
  39. define Package/msmtpq-ng/description
  40. $(call Package/msmtp-scripts/Default/description)
  41. This package contains the msmtpq-ng and msmtpq-ng-queue
  42. wrappers around msmtp, which provide the bulk of the
  43. functionality.
  44. endef
  45. define Package/msmtpq-ng-mta
  46. $(call Package/msmtp-scripts/Default)
  47. TITLE+= (as MTA)
  48. DEPENDS+=+msmtpq-ng
  49. USERID:=msmtp=482:msmtp=482
  50. endef
  51. define Package/msmtp-queue-mta/conffiles
  52. /etc/msmtpq-ng-mta.rc
  53. endef
  54. define Package/msmtpq-ng-mta/description
  55. $(call Package/msmtp-scripts/Default/description)
  56. This package provides sendmail, mailq, postfix,
  57. and postsuper symlinks to wrappers that configure
  58. msmtpq-ng for use as the system mail transport
  59. agent via the sendmail command.
  60. endef
  61. define Package/msmtpq-ng-mta-smtpd
  62. $(call Package/msmtp-scripts/Default)
  63. DEPENDS+= +msmtpq-ng-mta +xinetd
  64. TITLE+= (basic SMTP server)
  65. endef
  66. define Package/msmtp-ng-mta-smtpd/description
  67. $(call Package/msmtp-scripts/Default/description)
  68. This package uses the -bs option to msmtpq-ng
  69. (which, like the sendmail -bs command, provides
  70. SMTP over stdin/stdout) combined with xinetd to
  71. provide a basic SMTP server. In it's default
  72. configuration it only accepts connections from
  73. localhost AND network mail must be released from
  74. the hold queue before it can be delivered.
  75. endef
  76. define Package/msmtpq-ng-mta/postinst
  77. mkdir -p $${IPKG_INSTROOT}/etc/crontabs
  78. if ! grep -q msmtpq-ng-mta $${IPKG_INSTROOT}/etc/crontabs/root; then echo $$'\n'"*/60 * * * * /usr/bin/msmtpq-ng-mta -q" >>$${IPKG_INSTROOT}/etc/crontabs/root; fi
  79. endef
  80. define Package/msmtp-queue-mta/prerm
  81. if grep -q msmtpq-ng-mta $${IPKG_INSTROOT}/etc/crontabs/root; then grep -v '\*/60 \* \* \* \* /usr/bin/msmtpq-ng-mta -q' $${IPKG_INSTROOT}/etc/crontabs/root >$${IPKG_INSTROOT}/etc/crontabs/root.new; mv -f $${IPKG_INSTROOT}/etc/crontabs/root.new $${IPKG_INSTROOT}/etc/crontabs; fi
  82. endef
  83. define Build/Configure
  84. true
  85. endef
  86. define Build/Compile
  87. true
  88. endef
  89. define Package/msmtpq-ng/install
  90. $(INSTALL_DIR) $(1)/etc
  91. $(INSTALL_CONF) ./files/msmtpq-ng.rc $(1)/etc/msmtpq-ng.rc
  92. $(INSTALL_DIR) $(1)/usr/bin
  93. $(CP) $(PKG_BUILD_DIR)/msmtpq-ng/msmtpq-ng $(1)/usr/bin/
  94. $(SED) 's/logger -i/logger/' $(1)/usr/bin/msmtpq-ng
  95. $(CP) $(PKG_BUILD_DIR)/msmtpq-ng/msmtpq-ng-queue $(1)/usr/bin/
  96. endef
  97. define Package/msmtpq-ng-mta/install
  98. $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/sbin $(1)/usr/lib $(1)/etc/init.d
  99. $(INSTALL_CONF) $(PKG_BUILD_DIR)/msmtpq-ng-mta/msmtpq-ng-mta.rc $(1)/etc/
  100. echo 'MSMTP_LOCK_DIR=/var/lock/msmtp' >>$(1)/etc/msmtpq-ng-mta.rc
  101. $(INSTALL_BIN) $(PKG_BUILD_DIR)/msmtpq-ng-mta/msmtpq-ng-mta $(1)/usr/bin/
  102. $(INSTALL_BIN) $(PKG_BUILD_DIR)/msmtpq-ng-mta/msmtpq-ng-queue-mta $(1)/usr/bin/
  103. $(INSTALL_DIR) $(1)/etc/crontabs
  104. $(INSTALL_BIN) ./files/msmtpq-ng-mta.init $(1)/etc/init.d/msmtpq-ng-mta
  105. ln -sf ../bin/msmtpq-ng-mta $(1)/usr/sbin/sendmail
  106. ln -sf ../bin/msmtpq-ng-mta $(1)/usr/lib/sendmail
  107. ln -sf ../bin/msmtpq-ng-queue-mta $(1)/usr/sbin/mailq
  108. ln -sf ../bin/msmtpq-ng-queue-mta $(1)/usr/sbin/postqueue
  109. ln -sf ../bin/msmtpq-ng-queue-mta $(1)/usr/sbin/postsuper
  110. endef
  111. define Package/msmtpq-ng-mta-smtpd/install
  112. $(INSTALL_DIR) $(1)/etc/xinetd.d
  113. $(INSTALL_BIN) $(PKG_BUILD_DIR)/msmtpq-ng-mta/sendmail-bs.xinetd $(1)/etc/xinetd.d/msmtpq-ng-mta-smtpd
  114. endef
  115. $(eval $(call BuildPackage,msmtpq-ng))
  116. $(eval $(call BuildPackage,msmtpq-ng-mta))
  117. $(eval $(call BuildPackage,msmtpq-ng-mta-smtpd))