Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Sep 2011 02:40:29 -0700
From:      Doug Barton <dougb@FreeBSD.org>
To:        Steve Wills <swills@FreeBSD.org>
Cc:        cvs-ports@FreeBSD.org, cvs-all@FreeBSD.org, ports-committers@FreeBSD.org
Subject:   Re: cvs commit: ports/databases/mysql-proxy Makefile distinfo pkg-plist ports/databases/mysql-proxy/files mysql-proxy.in
Message-ID:  <4E80488D.8060000@FreeBSD.org>
In-Reply-To: <4E7FEE06.9050305@FreeBSD.org>
References:  <201109181958.p8IJwFfZ062133@repoman.freebsd.org> <4E7EBF4C.90205@FreeBSD.org> <4E7FEE06.9050305@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080604070203020703070408
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On 09/25/2011 20:14, Steve Wills wrote:
> I've tried to do that in the past when you've asked about it previously,
> but it always fails in testing for me. When I tried to understand why,
> it seemed to be some shell subtlety that involved variables set inside
> subroutines not being global in some cases. 

It's not that exactly, it's related to the order in which the variables
are evaluated when rc runs the script. command_args is evaluated first
(at which point ${proxy_backend_addresses} is empty), and then
run_rc_command starts running the routines for start, including
start_precmd and start_cmd.

The attached works, please test.


Doug

-- 

	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/


--------------080604070203020703070408
Content-Type: text/plain;
 name="mysql-proxy-rcd.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="mysql-proxy-rcd.diff"

Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/databases/mysql-proxy/Makefile,v
retrieving revision 1.29
diff -u -r1.29 Makefile
--- Makefile	23 Sep 2011 22:21:36 -0000	1.29
+++ Makefile	26 Sep 2011 09:36:43 -0000
@@ -7,6 +7,7 @@
 
 PORTNAME=	mysql-proxy
 PORTVERSION=	0.8.2
+PORTREVISION=	1
 CATEGORIES=	databases
 MASTER_SITES=	${MASTER_SITE_MYSQL}
 MASTER_SITE_SUBDIR=	MySQL-Proxy
Index: files/mysql-proxy.in
===================================================================
RCS file: /home/pcvs/ports/databases/mysql-proxy/files/mysql-proxy.in,v
retrieving revision 1.4
diff -u -r1.4 mysql-proxy.in
--- files/mysql-proxy.in	18 Sep 2011 19:58:15 -0000	1.4
+++ files/mysql-proxy.in	26 Sep 2011 09:36:43 -0000
@@ -1,12 +1,10 @@
 #!/bin/sh
-#
+
 # $FreeBSD: ports/databases/mysql-proxy/files/mysql-proxy.in,v 1.4 2011/09/18 19:58:15 swills Exp $
 #
-
 # PROVIDE: mysql-proxy
 # REQUIRE: LOGIN
 # KEYWORD: shutdown
-
 #
 # Add the following line to /etc/rc.conf to enable mysql-proxy:
 # mysql_proxy_enable (bool):		Set to "NO" by default.
@@ -35,15 +33,21 @@
 : ${mysql_proxy_enable="NO"}
 : ${mysql_proxy_address=":4040"}
 : ${mysql_proxy_backend_addresses="127.0.0.1:3306"}
-: ${mysql_proxy_pid_file="/var/run/mysql-proxy.pid"}
 
-for addr in ${mysql_proxy_backend_addresses}; do
-	proxy_backend_addresses="${proxy_backend_addresses} --proxy-backend-addresses=${addr}"
-done
+start_precmd="${name}_prestart"
+
+mysql_proxy_prestart()
+{
+	local addr
+
+	for addr in ${mysql_proxy_backend_addresses}; do
+		command_args="${command_args} --proxy-backend-addresses=${addr}"
+	done
+}
 
-pidfile="${mysql_proxy_pid_file}"
+pidfile="${mysql_proxy_pid_file:-"/var/run/mysql-proxy.pid"}"
 command=%%PREFIX%%/libexec/mysql-proxy
-command_args="--proxy-address=${mysql_proxy_address} ${proxy_backend_addresses} ${mysql_proxy_args} --daemon --pid-file=${mysql_proxy_pid_file}"
+command_args="--proxy-address=${mysql_proxy_address} ${mysql_proxy_args} --daemon --pid-file=${pidfile}"
 procname=%%PREFIX%%/libexec/mysql-proxy
 
 run_rc_command "$1"

--------------080604070203020703070408--



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