Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jul 2011 23:05:47 -0700
From:      Doug Barton <dougb@FreeBSD.org>
To:        Cheng-Lung Sung <clsung@FreeBSD.org>
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
Message-ID:  <4E27C1BB.7040901@FreeBSD.org>
In-Reply-To: <201107060026.p660Qjxr034952@repoman.freebsd.org>
References:  <201107060026.p660Qjxr034952@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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" <magik_AT_roorback dot net>
>   
>   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--



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