From owner-cvs-all@FreeBSD.ORG Mon Sep 26 09:40:32 2011 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id E11FE106564A; Mon, 26 Sep 2011 09:40:31 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 828A014DDB3; Mon, 26 Sep 2011 09:40:29 +0000 (UTC) Message-ID: <4E80488D.8060000@FreeBSD.org> Date: Mon, 26 Sep 2011 02:40:29 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0.2) Gecko/20110912 Thunderbird/6.0.2 MIME-Version: 1.0 To: Steve Wills References: <201109181958.p8IJwFfZ062133@repoman.freebsd.org> <4E7EBF4C.90205@FreeBSD.org> <4E7FEE06.9050305@FreeBSD.org> In-Reply-To: <4E7FEE06.9050305@FreeBSD.org> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: multipart/mixed; boundary="------------080604070203020703070408" 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 X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Sep 2011 09:40:32 -0000 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--