From owner-cvs-ports@FreeBSD.ORG Thu Jul 21 06:05:49 2011 Return-Path: Delivered-To: cvs-ports@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 8DBD51065672; Thu, 21 Jul 2011 06:05:49 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 65-241-43-4.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id DB38714D87C; Thu, 21 Jul 2011 06:05:47 +0000 (UTC) Message-ID: <4E27C1BB.7040901@FreeBSD.org> Date: Wed, 20 Jul 2011 23:05:47 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110706 Thunderbird/5.0 MIME-Version: 1.0 To: Cheng-Lung Sung References: <201107060026.p660Qjxr034952@repoman.freebsd.org> In-Reply-To: <201107060026.p660Qjxr034952@repoman.freebsd.org> X-Enigmail-Version: 1.2pre OpenPGP: id=1A1ABC84 Content-Type: multipart/mixed; boundary="------------070304030808010306060106" Cc: cvs-ports@FreeBSD.org, cvs-all@FreeBSD.org, ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/www/trac Makefile ports/www/trac/files tracd.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: Thu, 21 Jul 2011 06:05:49 -0000 This is a multi-part message in MIME format. --------------070304030808010306060106 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit I realize that you copied this script, but it has issues. :) I know I've said it before, but this is why I'm so pedantic about reviewing the rc.d scripts, bad examples are copied, seemingly with more frequency than good ones. :-/ One of the issues with this script is that it's pretty convoluted. Therefore I _think_ I got everything working the way it did before, but it needs testing. Particularly the _trac_env stuff. The single most important change is tracd_args -> tracd_flags. I don't know why this _args keeps slipping in, but it's not standard, and shouldn't be used. The advantage of _flags is that it's handled transparently by rc.subr. Beyond that, I've removed the default empty variable assignments, they are not necessary or desirable, especially when you have such good documentation in the headers. There are a variety of other simplifications, and I moved the environment settings into a start_precmd. Like I said, this needs testing. If you have any questions, feel free to follow up to freebsd-rc@. Doug On 07/05/2011 17:26, Cheng-Lung Sung wrote: > clsung 2011-07-06 00:26:45 UTC > > FreeBSD ports repository > > Modified files: > www/trac Makefile > Added files: > www/trac/files tracd.in > Log: > - Since trac can work as standalone http server, I copied rc script from old trac-multirepos port. > - also fixed portlint warning about CONFLICTS line. > > PR: ports/155295 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=155295 > Submitted by: "Grzegorz Blach" > > Revision Changes Path > 1.54 +7 -3 ports/www/trac/Makefile > 1.1 +61 -0 ports/www/trac/files/tracd.in (new) > > http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/www/trac/Makefile.diff?&r1=1.53&r2=1.54&f=h > http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/www/trac/files/tracd.in > -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ --------------070304030808010306060106 Content-Type: text/plain; name="tracd.in.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="tracd.in.diff" Index: tracd.in =================================================================== RCS file: /home/pcvs/ports/www/trac/files/tracd.in,v retrieving revision 1.1 diff -u -r1.1 tracd.in --- tracd.in 6 Jul 2011 00:26:45 -0000 1.1 +++ tracd.in 21 Jul 2011 05:53:57 -0000 @@ -1,13 +1,10 @@ #!/bin/sh -# -# tracd startup -# -# $FreeBSD: ports/www/trac/files/tracd.in,v 1.1 2011/07/06 00:26:45 clsung Exp $ +# $FreeBSD: ports/www/trac/files/tracd.in,v 1.1 2011/07/06 00:26:45 clsung Exp $ +# # PROVIDE: tracd # REQUIRE: LOGIN # KEYWORD: shutdown - # # Add the following lines to /etc/rc.conf to enable or configure tracd: # tracd_enable (bool): Set to "NO" by default. @@ -23,39 +20,43 @@ # tracd_env (str): The project environment name while using single # environment mode. The default is empty, meaning # multiproject mode. -# tracd_args (str): Extra arguments passed to tracd startup +# tracd_flags (str): Extra arguments passed to tracd startup # command. Empty by default. -# . /etc/rc.subr name="tracd" rcvar="${name}_enable" +load_rc_config ${name} + tracd_enable=${tracd_enable:-"NO"} tracd_listen=${tracd_listen:-"0.0.0.0"} tracd_port=${tracd_port:-"80"} -tracd_pidfile=${tracd_pidfile:-"/var/run/tracd.pid"} tracd_envdir=${tracd_envdir:-"/home/trac"} -tracd_env=${tracd_env:-""} -tracd_args=${tracd_args:-""} - -load_rc_config ${name} -command_args="--daemonize --hostname=${tracd_listen} --port=${tracd_port}" -command_args="${command_args} --pidfile=${tracd_pidfile} ${tracd_args}" +pidfile=${tracd_pidfile:-"/var/run/tracd.pid"} required_dirs=${tracd_envdir} -pidfile=${tracd_pidfile} -if [ -z "${tracd_env}" ]; then - _trac_env="--env-parent-dir ${tracd_envdir}" -else - _trac_env="${tracd_envdir}/${tracd_env}" - command_args="${command_args} --single-env" -fi +command_args="%%PREFIX%%/bin/tracd --hostname=${tracd_listen} \ + --port=${tracd_port} --pidfile=${tracd_pidfile} --daemonize" + +start_precmd="${name}_prestart" + +tracd_prestart() +{ + local _trac_env + + if [ -z "${tracd_env}" ]; then + _trac_env="--env-parent-dir ${tracd_envdir}" + else + _trac_env="--single-env ${tracd_envdir}/${tracd_env}" + fi + + command_args="$command_args $_trac_env" +} -command_args="%%PREFIX%%/bin/tracd ${command_args} ${_trac_env}" command="%%PYTHON_CMD%%" run_rc_command $1 --------------070304030808010306060106--