From owner-cvs-all@FreeBSD.ORG Tue Jan 3 00:01:26 2012 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 3A5151065673; Tue, 3 Jan 2012 00:01:26 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 8DC8314DF43; Tue, 3 Jan 2012 00:01:24 +0000 (UTC) Message-ID: <4F024553.4090309@FreeBSD.org> Date: Mon, 02 Jan 2012 16:01:23 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Chris Rees References: <201201022038.q02KcXat088232@repoman.freebsd.org> In-Reply-To: <201201022038.q02KcXat088232@repoman.freebsd.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: multipart/mixed; boundary="------------080100080404080405050303" Cc: cvs-ports@FreeBSD.org, cvs-all@FreeBSD.org, ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/mail/mailscanner Makefile ports/mail/mailscanner/files mailscanner.in X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 00:01:26 -0000 This is a multi-part message in MIME format. --------------080100080404080405050303 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit The mailscanner.in script has some "issues." Most of which can be resolved by careful review of http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/rc-scripts.html. However there are some more subtle things here as well. _user is a "magical" variable, it causes rc.subr to use su by default. So the mailscanner_start method is almost certainly not necessary. The mailscanner_user test should not run unconditionally, but since now the only thing it is needed for is the pid file, there's no reason not to just do that unconditionally. This change should be tested of course, but I'm fairly sure it will work. The mta.in script could also stand a little polishing along some of the same lines. Doug On 01/02/2012 12:38, Chris Rees wrote: > crees 2012-01-02 20:38:33 UTC > > FreeBSD ports repository > > Modified files: > mail/mailscanner Makefile > mail/mailscanner/files mailscanner.in > Log: > Add reload function to rc script > > PR: ports/163786 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=163786 > Submitted by: Carl Lindberg > > Revision Changes Path > 1.97 +1 -0 ports/mail/mailscanner/Makefile > 1.5 +1 -0 ports/mail/mailscanner/files/mailscanner.in > > http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/mail/mailscanner/Makefile.diff?&r1=1.96&r2=1.97&f=h > http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/mail/mailscanner/files/mailscanner.in.diff?&r1=1.4&r2=1.5&f=h > -- You can observe a lot just by watching. -- Yogi Berra Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ --------------080100080404080405050303 Content-Type: text/plain; name="mailscanner.in.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mailscanner.in.diff" Index: mailscanner.in =================================================================== RCS file: /home/pcvs/ports/mail/mailscanner/files/mailscanner.in,v retrieving revision 1.5 diff -u -r1.5 mailscanner.in --- mailscanner.in 2 Jan 2012 20:38:33 -0000 1.5 +++ mailscanner.in 2 Jan 2012 23:56:07 -0000 @@ -1,17 +1,20 @@ #! /bin/sh +# $FreeBSD$ +# # PROVIDE: mailscanner # REQUIRE: mta # KEYWORD: shutdown - # # Add the following lines to /etc/rc.conf to enable mailscanner: # mailscanner_enable (bool): Set to "NO" by default. # Set it to "YES" to enable mailscanner # mailscanner_configfile (path): Set to "%%PREFIX%%/etc/MailScanner/MailScanner.conf" by default. # mailscanner_pidfile (path): Set to "/var/run/MailScanner.pid" by default. -# mailscanner_user (str): Set to "root" by default. If you changed the "Run As User" variable in MailScanner.conf and wish to disable taint mode, you MUST also set the same value here. # +# mailscanner_user (str): Set to "root" by default. +# If you changed the "Run As User" variable in MailScanner.conf and wish +# to disable taint mode,you MUST also set the same value here. . /etc/rc.subr @@ -20,32 +23,15 @@ load_rc_config $name -: ${mailscanner_enable="NO"} -: ${mailscanner_configfile="%%PREFIX%%/etc/MailScanner/MailScanner.conf"} -: ${mailscanner_pidfile="/var/run/MailScanner.pid"} +: ${mailscanner_enable:="NO"} + +required_files=${mailscanner_configfile:-"%%PREFIX%%/etc/MailScanner/MailScanner.conf"} +pidfile=${mailscanner_pidfile:-"/var/run/MailScanner.pid"} command="%%PREFIX%%/sbin/mailscanner" -pidfile=${mailscanner_pidfile} -command_args="${mailscanner_configfile}" +command_args="${required_files}" procname="MailScanner" +start_precmd="install -o ${mailscanner_user:-root} /dev/null $pidfile" extra_commands=reload -required_files="${mailscanner_configfile}" - -pid_touch () -{ - touch $mailscanner_pidfile - chown $mailscanner_user $mailscanner_pidfile -} - -mailscanner_start() { - su -m ${mailscanner_user} -c "exec ${command} ${command_args}" -} - -if [ -n "${mailscanner_user}" ]; then - start_cmd="mailscanner_start" - start_precmd="pid_touch" -fi - run_rc_command "$1" - --------------080100080404080405050303--