git: 9ce8c29b90c7 - main - mail/postsrsd: Fix `service postsrsd stop` exit code

From: Romain Tartière <romain_at_FreeBSD.org>
Date: Sun, 08 Oct 2023 23:54:47 UTC
The branch main has been updated by romain:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9ce8c29b90c7d8a5f62fd3dcc8afd48c6aede960

commit 9ce8c29b90c7d8a5f62fd3dcc8afd48c6aede960
Author:     Krzysztof <ports@bsdserwis.com>
AuthorDate: 2023-10-08 23:51:42 +0000
Commit:     Romain Tartière <romain@FreeBSD.org>
CommitDate: 2023-10-08 23:51:42 +0000

    mail/postsrsd: Fix `service postsrsd stop` exit code
    
    Also improve integration with the sample configuration file.
    
    PR:             274168
    Approved by:    Krzysztof <ports@bsdserwis.com> (maintainer)
---
 mail/postsrsd/Makefile          | 9 +++++++--
 mail/postsrsd/files/postsrsd.in | 7 -------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/mail/postsrsd/Makefile b/mail/postsrsd/Makefile
index bf7cd417785b..387d4b2245c3 100644
--- a/mail/postsrsd/Makefile
+++ b/mail/postsrsd/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	postsrsd
 DISTVERSION=	2.0.8
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	1
 CATEGORIES=	mail
 
@@ -34,7 +34,8 @@ SUB_FILES=	pkg-message
 PLIST_FILES=	\
 		sbin/postsrsd \
 		"@sample ${ETCDIR}.conf.sample" \
-		"@dir /var/db/${PORTNAME}"
+		"@dir /var/db/${PORTNAME}" \
+		"@dir /var/run/${PORTNAME}"
 
 PORTDOCS=	CHANGELOG.rst README.rst postsrsd.conf
 
@@ -50,7 +51,11 @@ SQLITE_DESC=	Use sqlite3 backebd for storing envelope senders
 SQLITE_USES=	sqlite
 SQLITE_CMAKE_BOOL=	WITH_SQLITE
 
+post-patch:
+		${REINPLACE_CMD} -e '/^chroot-dir/ s/^/#/' ${WRKSRC}/doc/postsrsd.conf
+
 post-install:
 		${INSTALL_DATA} ${WRKSRC}/doc/postsrsd.conf ${STAGEDIR}${PREFIX}/etc/postsrsd.conf.sample
+		${MKDIR} ${STAGEDIR}/var/run/${PORTNAME}
 
 .include <bsd.port.mk>
diff --git a/mail/postsrsd/files/postsrsd.in b/mail/postsrsd/files/postsrsd.in
index 1e0617568447..29a89b8bdefa 100644
--- a/mail/postsrsd/files/postsrsd.in
+++ b/mail/postsrsd/files/postsrsd.in
@@ -22,7 +22,6 @@ name="postsrsd"
 rcvar=postsrsd_enable
 
 start_precmd="postsrsd_prepcmd"
-stop_postcmd="postsrsd_postcmd"
 command="%%PREFIX%%/sbin/postsrsd"
 _piddir="/var/run/postsrsd"
 pidfile="${_piddir}/${name}.pid"
@@ -56,12 +55,6 @@ postsrsd_prepcmd ()
     fi
 }
 
-postsrsd_postcmd()
-{
-    # just if the directory is empty
-    rmdir ${_piddir} > /dev/null 2>&1
-}
-
 # to let rc.subr kill them all
 unset pidfile