git: 15033a23ac4f - 2026Q3 - mail/mailman3: Update rc.d script

Jochen Neumeister <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.ports
Message-ID <[email protected]>
The branch 2026Q3 has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=15033a23ac4f603e23ad01a7b649acd95be83b25

commit 15033a23ac4f603e23ad01a7b649acd95be83b25
Author:     Einar Bjarni Halldórsson <[email protected]>
AuthorDate: 2026-08-16 19:09:12 +0000
Commit:     Jochen Neumeister <[email protected]>
CommitDate: 2026-08-16 19:15:13 +0000

    mail/mailman3: Update rc.d script
    
    Fix the exit code of "service mailman status".  Mailman's own status
    command exits 0 when it is not running and 1 when it is, which is the
    inverse of the rc.subr convention.  Wrap it so that a running master
    yields 0, as service(8) consumers such as Ansible expect.
    
    Also add a start_precmd that detects an already running master via the
    pidfile, so that "service mailman start" no longer dumps a full click
    usage block on a second invocation.
    
    PR:             292404
    Sponsored by:   Netzkommune GmbH
    
    (cherry picked from commit ae15f89980dff827563056d876641f942a70c6dd)
---
 mail/mailman3/Makefile         |  2 +-
 mail/mailman3/files/mailman.in | 25 ++++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/mail/mailman3/Makefile b/mail/mailman3/Makefile
index a83cf35b4de3..f3824fa8ba07 100644
--- a/mail/mailman3/Makefile
+++ b/mail/mailman3/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	mailman
 DISTVERSION=	3.3.10
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	mail
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/mail/mailman3/files/mailman.in b/mail/mailman3/files/mailman.in
index 6e6a1abb8425..43e425135755 100644
--- a/mail/mailman3/files/mailman.in
+++ b/mail/mailman3/files/mailman.in
@@ -25,10 +25,11 @@ load_rc_config $name
 command_interpreter=%%PYTHON_CMD%%
 command=%%PREFIX%%/bin/${name}
 
+start_precmd="mailman_prestart"
 start_cmd="mailman_command start"
 stop_cmd="mailman_command stop"
 restart_cmd="mailman_command restart"
-status_cmd="mailman_command status"
+status_cmd="mailman_status"
 info_cmd="mailman_command info"
 extra_commands=info
 
@@ -37,6 +38,28 @@ pidfile="%%PREFIX%%/${name}/master.pid"
 
 command_args="-C ${mailman_config}"
 
+mailman_prestart()
+{
+	rc_pid=$(check_pidfile ${pidfile} ${command_interpreter})
+	if [ -n "$rc_pid" ]; then
+		echo "Mailman already running"
+		return 1
+	fi
+}
+mailman_status()
+{
+	# Mailman status return codes:
+	# 0: No lock has been acquired by any process
+	# 1: Another master watcher is running
+	# 2: No conflicting process exists
+	# 3: Hostname from lock file doesn't match
+	mailman_command status
+	if [ $? -eq 1 ]; then
+		return 0
+	else
+		return 1
+	fi
+}
 mailman_command()
 {
 	LANG=en_US.UTF-8 /usr/bin/su -m ${name} -c "${command_interpreter} ${command} ${command_args} ${rc_arg}"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.