From owner-cvs-ports@FreeBSD.ORG Mon Feb 1 21:43:50 2010 Return-Path: Delivered-To: cvs-ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A0931065679 for ; Mon, 1 Feb 2010 21:43:50 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 8787D8FC18 for ; Mon, 1 Feb 2010 21:43:49 +0000 (UTC) Received: (qmail 7550 invoked by uid 399); 1 Feb 2010 21:43:48 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 1 Feb 2010 21:43:48 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B674B1C.8040203@FreeBSD.org> Date: Mon, 01 Feb 2010 13:43:56 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.7) Gecko/20100123 Thunderbird/3.0.1 MIME-Version: 1.0 To: "Philip M. Gollucci" References: <201002011745.o11HjVaY099715@repoman.freebsd.org> In-Reply-To: <201002011745.o11HjVaY099715@repoman.freebsd.org> X-Enigmail-Version: 1.0 OpenPGP: id=D5B2F0FB Content-Type: multipart/mixed; boundary="------------040209010808050605050207" Cc: cvs-ports@FreeBSD.org, Boris Kovalenko , Emil Smolenski , cvs-all@FreeBSD.org, ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/net/quagga Makefile ports/net/quagga/files quagga.sh.in X-BeenThere: cvs-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2010 21:43:50 -0000 This is a multi-part message in MIME format. --------------040209010808050605050207 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 02/01/10 09:45, Philip M. Gollucci wrote: > pgollucci 2010-02-01 17:45:31 UTC > > FreeBSD ports repository > > Modified files: > net/quagga Makefile > net/quagga/files quagga.sh.in > Log: > - Fix the return value of the rc.d script > > PR: ports/143086 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=143086 > Submitted by: Emil Smolenski > Approved by: Boris Kovalenko (maintainer) > > Revision Changes Path > 1.96 +1 -1 ports/net/quagga/Makefile > 1.16 +4 -1 ports/net/quagga/files/quagga.sh.in > > http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/net/quagga/Makefile.diff?&r1=1.95&r2=1.96&f=h > http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/net/quagga/files/quagga.sh.in.diff?&r1=1.15&r2=1.16&f=h There is a better way to accomplish what this change does which I included in the attached patch. Most of the other changes are to bring the script in line with customs, see http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/rc-scripts.html for more information. Regarding the other changes: 1. (Hopefully) improve readability for the comments 2. Add quagga_extralibs_path to the comments, some description should be included there instead of "blah blah." :) The reason for this is that the default empty variable assignments have been removed (they are neither necessary nor desirable). 3. The construction "while true; do" is usually safe, but better to use the shell internal way of saying the same thing. 4. Make $daemon in do_cmd local I also have a sort of meta-concern about the way this script is constructed. It would be "cleaner" to do individual scripts for each daemon, however given the large number of daemons that are started I can see an argument that this way is better. The other concern I have is minor, if "-d" is the option to daemonize the daemons then it should be moved to command_args (outside of do_cmd should be fine) and the then-empty _flags default should be removed. Usual caveats apply, these changes should be tested, maintainer should submit a request for them, etc. Doug -- Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ Computers are useless. They can only give you answers. -- Pablo Picasso --------------040209010808050605050207 Content-Type: text/plain; name="quagga.sh.in-diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="quagga.sh.in-diff" Index: quagga.sh.in =================================================================== RCS file: /home/pcvs/ports/net/quagga/files/quagga.sh.in,v retrieving revision 1.16 diff -u -r1.16 quagga.sh.in --- quagga.sh.in 1 Feb 2010 17:45:31 -0000 1.16 +++ quagga.sh.in 1 Feb 2010 21:31:40 -0000 @@ -1,38 +1,43 @@ #!/bin/sh -# +# $FreeBSD$ +# # PROVIDE: quagga # REQUIRE: netif routing # KEYWORD: nojail - # # Add the following line to /etc/rc.conf to enable quagga: -#quagga_enable="YES" +# quagga_enable="YES" # # You may also wish to use the following variables to fine-tune startup: -# quagga_flags="-d" -# quagga_daemons="zebra ripd ripngd ospfd ospf6d bgpd isisd" +# quagga_flags="-d" +# quagga_daemons="zebra ripd ripngd ospfd ospf6d bgpd isisd" +# # Per daemon tuning may be done with daemon_name_flags -# zebra_flags="-dP 0" -# bgpd_flags="-dnrP 0" and so on +# zebra_flags="-dP 0" +# bgpd_flags="-dnrP 0" and so on +# # If you want to give the routing deamons a chance to catchup before # continueing, set quagga_wait_for to a "default" or certain prefix. -# quagga_wait_for="default" +# quagga_wait_for="default" +# +# BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH +# quagga_extralibs_path= # # If the quagga daemons require additional shared libraries to start, # use the following variable to run ldconfig(8) in advance: -#quagga_extralibs_path="/usr/local/lib ..." +# quagga_extralibs_path="/usr/local/lib ..." # -. %%RC_SUBR%% +. /etc/rc.subr name="quagga" rcvar=`set_rcvar` -start_postcmd=start_postcmd -stop_postcmd=stop_postcmd +start_postcmd=${name}_poststart +stop_postcmd=${name}_poststop -start_postcmd() +quagga_poststart() { # Wait only when last daemon has started. if [ "${quagga_daemons}" = "${quagga_daemons% ${name}}" ]; then @@ -40,22 +45,22 @@ fi if [ ${quagga_wait_for} ]; then echo Waiting for ${quagga_wait_for} route... - while true; do + while : ; do /sbin/route -n get ${quagga_wait_for} >/dev/null 2>&1 && break; sleep 1; done fi } -stop_postcmd() +quagga_poststop() { rm -f $pidfile } do_cmd() { - local ret - ret=0 + local daemon + for daemon in ${quagga_daemons}; do command=%%PREFIX%%/sbin/${daemon} required_files=%%SYSCONF_DIR%%/${daemon}.conf @@ -69,9 +74,8 @@ eval flags=\$\{${daemon}_flags:-\"${quagga_flags}\"\} name=${daemon} _rc_restart_done=false - run_rc_command "$1" || ret=1 + run_rc_command "$1" || return 1 done - return ${ret} } # set defaults @@ -81,8 +85,6 @@ : ${quagga_enable="NO"} : ${quagga_flags="-d"} : ${quagga_daemons="zebra ripd ripngd ospfd ospf6d bgpd isisd"} -: ${quagga_extralibs_path=""} -: ${quagga_wait_for=""} quagga_cmd=$1 --------------040209010808050605050207--