tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] wip/dma: update to 0.14



On 17/11/2026 00:20, Greg Troxel wrote:
Philip Dodd <orange.spyderman%gmail.com@localhost> writes:

sbin is for programs invoked by a system administrator, or a script in
rc.d.

libexec is for programs invoked by other programs.
Thanks, that's helpful guidance.  On BSDs, where I expect dma to be
invoked via mailwrapper, libexec seems to be correct, rather than
sbin, and I assume that's also why FreeBSD packages it the way it
does.

But presumably on pkgsrc systems where there is no mailwrapper
equivalent, installing to libexec would leave users without a command
in the path.  Upstream does have separate make targets to make
sendmail, mailq symlinks to dma (but also in that case installs dma
into sbin...)
See pkgsrc/mail/mailwrapper, which provides the mailwrapper mechanisms
for other systems.  The pkgsrc-straightforward thing would be to install
in libexec always and expect those systems to use mailwrapper.

I suggest looking at all the other MTA packages and see what they do.  A
quick glance suggests they don't depend on mailwrapper and put a lot of
things in libexec, with commands for admins in sbin.

Thanks again for the steer, very helpful.

I've been checking up on what the "prior art" looks like for other MTAs in pkgsrc, and it does seem wip/dma is currently a bit of an outlier in this regard.  I like the straightforward approach and dma plays well with mailwrapper in my experience.

I would propose that a cleaner approach for pkgsrc would be :

- install dma to libexec

- provide example mailer.conf for mailwrapper users

- provide a pkg option that also provides the symlinks into sbin (for
   sendmail) or bin (for mailq, newaliases and possibly sendmail,
   because mailwrapper does this) for systems that rely on these, the
   way upstream and mailwrapper do

- (OPTIONALLY...) a separate package (dma-aliases?) for binary package
   users to achieve the same thing as the option without having to
  recompile...
It would be great to hear from Charlotte, but my 0.02 is that the fewer
options the better, and pkgsrc tends hard to doing everything in the
pkgsrc world the same everywhere.
Right, yes, I can see that less is probably more, especially for a package which exists largely to be a simpler MTA...
You have definitely absorbed that options and binary packages don't play
well together.

So yes, example mailer.conf (to be installed in share/examples/dma)
sounds good.

Done.  I have made a sample mailer.conf and a README.pkgsrc (in share/doc/dma) with a brief "Getting Started" message.

I've attached the current state of my branch including these more impactful changes.  pkglint -Wall "looks fine", and nothing jumps out at me when building with PKG_DEVELOPER=yes, but I'm new to this and it's now quite a bit more than just updating to 0.14 so definitely won't push this until there's a nod (or otherwise :) ) from Charlotte as maintainer.
diff --git a/dma/COMMIT_MSG b/dma/COMMIT_MSG
new file mode 100644
index 0000000000..230a2c07d2
--- /dev/null
+++ b/dma/COMMIT_MSG
@@ -0,0 +1,12 @@
+mail/dma: Add dma version 0.14
+
+dma is a small Mail Transport Agent for local mail submission and
+outbound delivery. It supports local delivery, SMTP authentication,
+TLS and certificate verification, without listening for incoming SMTP
+connections.
+
+Packaged in wip; updated to 0.14 by Philip Dodd.
+
+Packaging supports unprivileged staging, with privileged executable
+permissions applied during installation. The spool directory permits
+submission through the setgid dma executable.
diff --git a/dma/Makefile b/dma/Makefile
index c0d7ee93e3..43697d2b2d 100644
--- a/dma/Makefile
+++ b/dma/Makefile
@@ -1,6 +1,6 @@
 # $NetBSD$
 
-DISTNAME=	dma-0.13
+DISTNAME=	dma-0.14
 CATEGORIES=	mail
 MASTER_SITES=	${MASTER_SITE_GITHUB:=corecode/}
 GITHUB_TAG=	v${PKGVERSION_NOREV}
@@ -13,24 +13,27 @@ LICENSE=	modified-bsd
 BUILD_DEFS+=		VARBASE
 
 PKG_SYSCONFSUBDIR=	dma
-EGDIR=			${PREFIX}/share/exmaples/${PKGBASE}
+EGDIR=			${PREFIX}/share/examples/${PKGBASE}
+DOCDIR=			${PREFIX}/share/doc/${PKGBASE}
 
 USE_TOOLS+=	flex yacc
 LDFLAGS.SunOS+=	-lsocket -lnsl
 
-NO_CONFIGURE=	yes
 USE_LANGUAGES=	c
 
 .include "../../mk/bsd.prefs.mk"
 
 DMA_GROUP?=	dma
 DMA_ROOT_USER?=	dma
+SPECIAL_PERMS+=	${PREFIX}/libexec/dma \
+		${REAL_ROOT_USER} ${DMA_GROUP} 2555
+SPECIAL_PERMS+=	${PREFIX}/libexec/dma-mbox-create \
+		${REAL_ROOT_USER} ${DMA_GROUP} 4554
 PKG_GROUPS=	${DMA_GROUP}
 PKG_USERS=	${DMA_ROOT_USER}:${DMA_GROUP}
 
 CFLAGS+=	-DHAVE_GETPROGNAME
 CFLAGS+=	-DHAVE_STRLCPY
-CFLAGS+=	-DLIBEXEC_PATH=${PREFIX}/libexec
 CFLAGS+=	-DDMA_GROUP=\"${DMA_GROUP}\"
 CFLAGS+=	-DDMA_ROOT_USER=\"${DMA_ROOT_USER}\"
 
@@ -38,18 +41,30 @@ MAKE_ENV+=	CONFDIR=${PKG_SYSCONFDIR}
 
 MAKE_FLAGS=	"LIBEXEC=${PREFIX}/libexec"
 MAKE_FLAGS+=	"MAN=${PREFIX}/${PKGMANDIR}"
+MAKE_FLAGS+=	version=${PKGVERSION_NOREV}
 
-INSTALLATION_DIRS=	${EGDIR}
+INSTALLATION_DIRS=	${EGDIR} ${DOCDIR}
 
 CONF_FILES=	${EGDIR}/dma.conf ${PKG_SYSCONFDIR}/dma.conf
 CONF_FILES+=	${EGDIR}/auth.conf ${PKG_SYSCONFDIR}/auth.conf
 
 OWN_DIRS=	${VARBASE}/spool/dma
-OWN_DIRS_PERMS=	${VARBASE}/spool/dma ${DMA_ROOT_USER} ${DMA_GROUP} 750
+OWN_DIRS_PERMS=	${VARBASE}/spool/dma ${DMA_ROOT_USER} ${DMA_GROUP} 0770
+
+SUBST_CLASSES+=		mailer
+SUBST_STAGE.mailer=	pre-configure
+SUBST_FILES.mailer=	${WRKDIR}/mailer.conf
+SUBST_VARS.mailer=	PREFIX
+
+post-extract:
+	${CP} ${FILESDIR}/mailer.conf ${WRKDIR}/mailer.conf
+	${CP} ${FILESDIR}/README.pkgsrc ${WRKDIR}/README.pkgsrc
 
 post-install:
 	${INSTALL_DATA} ${WRKSRC}/dma.conf ${DESTDIR}${EGDIR}/dma.conf
 	${INSTALL_DATA} ${WRKSRC}/auth.conf ${DESTDIR}${EGDIR}/auth.conf
+	${INSTALL_DATA} ${WRKDIR}/mailer.conf ${DESTDIR}${EGDIR}/mailer.conf
+	${INSTALL_DATA} ${WRKDIR}/README.pkgsrc ${DESTDIR}${DOCDIR}/README.pkgsrc
 
 .include "../../security/openssl/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/dma/PLIST b/dma/PLIST
index 66705d3bfb..2a4f853916 100644
--- a/dma/PLIST
+++ b/dma/PLIST
@@ -1,6 +1,8 @@
 @comment $NetBSD$
+libexec/dma
 libexec/dma-mbox-create
 man/man8/dma.8
-sbin/dma
-share/exmaples/dma/auth.conf
-share/exmaples/dma/dma.conf
+share/doc/dma/README.pkgsrc
+share/examples/dma/auth.conf
+share/examples/dma/dma.conf
+share/examples/dma/mailer.conf
diff --git a/dma/distinfo b/dma/distinfo
index 031744eab0..288cc7d01c 100644
--- a/dma/distinfo
+++ b/dma/distinfo
@@ -1,11 +1,10 @@
 $NetBSD$
 
-SHA1 (dma-0.13.tar.gz) = 2b6e871441fbf1282cab7f7a05783c310586e993
-RMD160 (dma-0.13.tar.gz) = 4213525ecdbad2d89aa0a7cb1d399a16daf258bf
-SHA512 (dma-0.13.tar.gz) = 12ca04c6e67ffeead4596dcbf6bbc42547461b224a7f70e7185822b5f968c369de4c20ae7de3415a54f6eef7d4acc12d5fca5ff5851d640f3611d89a345b41ac
-Size (dma-0.13.tar.gz) = 36315 bytes
-SHA1 (patch-Makefile) = 76395db385e3afb8f3d3678f12bb676c0ef73f67
-SHA1 (patch-dma.c) = a77711f474ded4c53eeb3176bd0c561777c15807
+BLAKE2s (dma-0.14.tar.gz) = 12d3e184851f64fe856cf79a01789b7d18fa05eeb0b03955b3f3e49be1b990eb
+SHA512 (dma-0.14.tar.gz) = c3ef94bb6f8fca64af673be392b9ae7f151bcfefb2996683dee101f15d777912f8ff5ecc9442c9c70e6d530db53baa4d71ff379018fb62632c85a8a61cc4b407
+Size (dma-0.14.tar.gz) = 37572 bytes
+SHA1 (patch-Makefile) = 97d174fac5e688d746cf41718991bfe3044d32d9
+SHA1 (patch-dma.c) = bfd81f7e343d9d75a6ef446d04bd30a11ccf0672
 SHA1 (patch-dma.h) = c1d57229ec790f5f11a18f277c19e0ba1cdcfdd4
 SHA1 (patch-dns.c) = 5f8a7adb8b1ca379ab8b837e56ca044d7699d2f1
 SHA1 (patch-mail.c) = b5397243763d2283cab33b1aa5d55cfd9ef4792e
diff --git a/dma/files/README.pkgsrc b/dma/files/README.pkgsrc
new file mode 100644
index 0000000000..190fb0ca8a
--- /dev/null
+++ b/dma/files/README.pkgsrc
@@ -0,0 +1,10 @@
+ Getting started
+ ===============
+
+Assuming you're using mailwrapper(8) or mail/mailwrapper from pkgsrc :
+
+- Replace /etc/mailer.conf with @PREFIX@/share/examples/dma/mailer.conf
+- You may also want to set up a crontab entry to retry messages from the queue in case of network drops etc E.g.
+
+*/5 * * * * @PREFIX@/sbin/dma -q
+
diff --git a/dma/files/mailer.conf b/dma/files/mailer.conf
new file mode 100644
index 0000000000..db9499ea51
--- /dev/null
+++ b/dma/files/mailer.conf
@@ -0,0 +1,4 @@
+sendmail    @PREFIX@/libexec/dma
+send-mail   @PREFIX@/libexec/dma
+mailq       @PREFIX@/libexec/dma
+newaliases  @PREFIX@/libexec/dma
diff --git a/dma/patches/patch-Makefile b/dma/patches/patch-Makefile
index 48a9a83340..dd0e052a4e 100644
--- a/dma/patches/patch-Makefile
+++ b/dma/patches/patch-Makefile
@@ -1,17 +1,12 @@
 $NetBSD$
 
-For setuid files its recommended to not set any write permissions
+Stage executables without privileged ownership or modes.
+The package declares their final permissions using SPECIAL_PERMS.
 
---- Makefile.orig	2016-02-23 20:01:56.895785904 +0000
+--- Makefile.orig
 +++ Makefile
-@@ -50,8 +50,8 @@ clean:
- install: all
- 	${INSTALL} -d ${DESTDIR}${SBIN}
- 	${INSTALL} -d ${DESTDIR}${MAN}/man8 ${DESTDIR}${LIBEXEC}
+@@ -55,2 +55,2 @@
 -	${INSTALL} -m 2755 -o root -g mail dma ${DESTDIR}${SBIN}
 -	${INSTALL} -m 4754 -o root -g mail dma-mbox-create ${DESTDIR}${LIBEXEC}
-+	${INSTALL} -m 2555 -o root -g mail dma ${DESTDIR}${SBIN}
-+	${INSTALL} -m 4554 -o root -g mail dma-mbox-create ${DESTDIR}${LIBEXEC}
- 	${INSTALL} -m 0644 dma.8 ${DESTDIR}${MAN}/man8/
- 
- sendmail-link:
++	${INSTALL} -m 0555 dma ${DESTDIR}${LIBEXEC}
++	${INSTALL} -m 0555 dma-mbox-create ${DESTDIR}${LIBEXEC}
diff --git a/dma/patches/patch-dma.c b/dma/patches/patch-dma.c
index a9572a6d82..c75a8eb924 100644
--- a/dma/patches/patch-dma.c
+++ b/dma/patches/patch-dma.c
@@ -20,7 +20,7 @@ Rename queue to dma_queue because the struct is already defined in SunOS.
 +set_from(struct dma_queue *queue, const char *osender)
  {
  	const char *addr;
- 	char *sender;
+ 	const char *from_user = NULL;
 @@ -153,7 +154,7 @@ read_aliases(void)
  }
  
@@ -66,12 +66,13 @@ Rename queue to dma_queue because the struct is already defined in SunOS.
  {
  	struct qitem *it;
  	int locked = 0;	/* XXX */
-@@ -421,7 +422,7 @@ main(int argc, char **argv)
+@@ -421,8 +422,8 @@ main(int argc, char **argv)
  {
  	struct sigaction act;
  	char *sender = NULL;
+ 	char *own_name = NULL;
 -	struct queue queue;
 +	struct dma_queue queue;
  	int i, ch;
- 	int nodot = 0, showq = 0, queue_only = 0;
+ 	int nodot = 0, showq = 0, queue_only = 0, newaliases = 0;
  	int recp_from_header = 0;


Home | Main Index | Thread Index | Old Index