Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2007 18:08:09 -0500
From:      "kitsune " <v.velox@vvelox.net>
To:        "FreeBSD gnats submit" <FreeBSD-gnats-submit@FreeBSD.org>
Subject:   ports/110109: Update port: mail/qmail add a boot script with rcNG support
Message-ID:  <1173395289.12978@vixen42.vulpes>
Resent-Message-ID: <200703082340.l28Ne3pZ049678@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         110109
>Category:       ports
>Synopsis:       Update port: mail/qmail add a boot script with rcNG support
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 08 23:40:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     kitsune
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:


System: FreeBSD 6.2-STABLE #2: Wed Mar  7 19:30:14 EST 2007
    root@vixen42.vulpes:/usr/obj/usr/src/sys/vixen42-2



>Description:


Currently none of the files install in /var/qmail/boot provide rcNG support. This one adds on to it that does.


>How-To-Repeat:


1: install a non-ldap qmail
2:
2: copy /var/qmail/boot/rcNG to /var/qmail/rc
3: less /var/qmail/rc to look at aviable rc.conf variables
4: configure rc.conf
5: enjoy


>Fix:


--- mail-qmail.diff begins here ---
diff -ruN qmail.bak/Makefile qmail/Makefile
--- qmail.bak/Makefile	Thu Mar  8 17:08:00 2007
+++ qmail/Makefile	Thu Mar  8 17:50:01 2007
@@ -690,6 +690,11 @@
 . if defined(SLAVE_SPAMCONTROL) && defined(WITH_SMTPEXTFORK)
 	${INSTALL_DATA} ${DISTDIR}/${DIST_SUBDIR}/README.smtpextfork ${DOCSDIR}
 . endif
+. if !defined(SLAVE_LDAP)
+	@${CP} -v ${PORTSDIR}/mail/qmail/files/rcNG ${PREFIX}/boot/rcNG
+	@${CHOWN} -v root:wheel ${PREFIX}/boot/rcNG
+	@${CHMOD} -v +x ${PREFIX}/boot/rcNG
+. endif
 . if defined(PACKAGE_BUILDING)
 	@${ECHO_CMD} "FreeBSD Binary package qmail installation" \
 		> ${DOCSDIR}/SYSDEPS
diff -ruN qmail.bak/files/rcNG qmail/files/rcNG
--- qmail.bak/files/rcNG	Wed Dec 31 19:00:00 1969
+++ qmail/files/rcNG	Thu Mar  8 18:02:56 2007
@@ -0,0 +1,83 @@
+#!/bin/sh
+
+# PROVIDE: qmail mail
+# REQUIRE: netif
+# BEFORE: LOGIN
+#
+#writen by Zane C. Bowers <vvelox@vvelox.net>
+
+. /etc/rc.subr
+
+name="qmail"
+rcvars=`set_rcvar`
+start_cmd="qmail_start"
+stop_cmd="qmail_stop"
+
+load_rc_config $name
+
+
+#
+# Add the following lines to /etc/rc.conf to enable qmail:
+# qmail_enable (bool):		Turn on QMail.
+#				Default: NO
+#
+# qmail_checkpw (str):		Tell QMail what chekpassword program to use.
+#				Default: /usr/local/bin/checkpassword
+#
+# qmail_checkpwsuccess (str):	Tell the server what to run if checkpassword works.
+#				Default: /bin/true
+#
+# qmail_server (bool):		Wether the SMTP server should be started.
+#				Default: YES
+#
+# qmail_server_ip (str):	The IP to listen on. 0 means all.
+#				Default: 0
+#
+# qmail_server_port (str):	The port to listen on. May be numeric or from /etc/services
+#				Default: smtp
+#
+# qmail_tcpserver_args (str):	Extra args to be passed to tcpserver.
+#
+# qmail_defaultdelivery (str):	Default delivery path.
+#				Default: ./Maildir
+# qmail_logger (str):		The logger to use.
+# 				Default: splogger qmail
+# qmail_server_logger (str):	The logger to use for the SMTP server.
+#				Default: /var/qmail/bin/splogger smtpd
+
+[ -z "$qmail_enable" ] && qmail_enable="NO"
+[ -z "$qmail_checkpw" ] && qmail_checkpw="/usr/local/bin/checkpassword"
+[ -z "$qmail_checkpwsuccess" ] && qmail_checkpw="/bin/true"
+[ -z "$qmail_server" ] && qmail_server="YES"
+[ -z "$qmail_server_ip" ] && qmail_server_ip="0"
+[ -z "$qmail_server_port" ] && qmail_server_port="smtp"
+[ -z "$qmail_defaultdelivery" ] && qmail_defaultdelivery="./Maildir"
+[ -z "$qmail_logger" ] && qmail_defaultdelivery="splogger qmail"
+[ -z "$qmail_server_logger" ] && qmail_server_logger="/var/qmail/bin/splogger smtpd"
+
+qmail_start(){
+    env - PATH="/var/qmail/bin:$PATH" \
+     qmail-start $qmail_defaultdelivery $qmail_server_logger &
+
+    if checkyesno qmail_server; then
+	qmaildUID=`id qmaild | cut -d\  -f 1 | cut -d= -f 2 | cut -d\( -f 1`
+	qnofilesGID=`pw group show qnofiles | cut -d: -f 3`
+	
+	env - PATH="/var/qmail/bin:$PATH" /usr/local/bin/tcpserver $qmail_tcpserver_args -u \
+	    $qmaildUID -g $qnofilesGID $qmail_server_ip $qmail_server_port \
+	    /var/qmail/bin/qmail-smtpd $qmail_checkpw -- /bin/true 2>&1 | $qmail_server_logger &
+    fi
+
+}
+
+qmail_stop(){
+    killall -9 qmail-send > /dev/null
+    
+    #tcpserverPID=`ps aux | grep tcpserver | grep ^qmaild | cut -d\  -f 4`
+    tcpserverPID=`ps -aw -o pid,user,command | grep tcpserver | grep qmail-smtpd | sed 's/^ *//' | cut -f 1 -d\ `
+    [ $tcpserverPID ] && kill -9 $tcpserverPID
+    #kill -9 $tcpserverPID
+}
+
+
+run_rc_command "$1"
diff -ruN qmail.bak/pkg-plist qmail/pkg-plist
--- qmail.bak/pkg-plist	Thu Mar  8 17:08:00 2007
+++ qmail/pkg-plist	Thu Mar  8 17:34:04 2007
@@ -66,6 +66,7 @@
 bin/sendmail
 bin/splogger
 bin/tcp-env
+%%NOT_LDAP%%boot/rcNG
 %%NOT_LDAP%%boot/binm1
 %%NOT_LDAP%%boot/binm1+df
 %%NOT_LDAP%%boot/binm2
--- mail-qmail.diff ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1173395289.12978>