cvs commit: ports/databases/mysql-proxy Makefile distinfo pkg-plist ports/databases/mysql-proxy/files mysql-proxy.in

Doug Barton dougb at FreeBSD.org
Mon Sep 26 09:40:32 UTC 2011


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/

-------------- next part --------------
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"


More information about the cvs-ports mailing list