msmtp-scripts: Make conn_test default nc

On OpenWrt nc (netcat) connectivity test makes more sense than
ping because a) for non-root users ping is not permitted, and
b) nc is a default binary included with OpenWrt.
We do, however, have to change the upstream default from using
`nc -vz` to `printf "<http head request>"|nc` (with openwrt
nc if text is sent then nc closes after a response and fails
if no connection is made; the response is already thrown away
(to /dev/null) by the existing code).

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
This commit is contained in:
Daniel F. Dickinson
2019-08-27 01:53:51 -04:00
parent 9c43805ae5
commit 3c15d410a9
3 changed files with 8 additions and 7 deletions
+2 -1
View File
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=msmtp-scripts
PKG_VERSION:=1.2.4
PKG_RELEASE:=1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://launchpad.net/$(PKG_NAME)/1.2/$(PKG_VERSION)/+download
@@ -116,6 +116,7 @@ define Package/msmtpq-ng/install
$(INSTALL_DATA) ./files/msmtpq-ng.rc $(1)/etc/msmtpq-ng.rc
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_BUILD_DIR)/src/usr/bin/msmtpq-ng $(1)/usr/bin/
$(SED) "s,nc -vz,printf \"HEAD / HTTP/1.1\\\\r\\\\nHost: \$$$${EMAIL_CONN_TEST_SITE}\\\\r\\\\n\\\\r\\\\n\"|nc," $(1)/usr/bin/msmtpq-ng
$(CP) $(PKG_BUILD_DIR)/src/usr/bin/msmtpq-ng-queue $(1)/usr/bin/
endef