Date: Mon, 02 Jan 2012 16:01:23 -0800 From: Doug Barton <dougb@FreeBSD.org> To: Chris Rees <crees@FreeBSD.org> 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 Message-ID: <4F024553.4090309@FreeBSD.org> In-Reply-To: <201201022038.q02KcXat088232@repoman.freebsd.org> References: <201201022038.q02KcXat088232@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <lindberg+freebsdbugs@clindberg.org> > > 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F024553.4090309>