From owner-freebsd-ports-bugs@FreeBSD.ORG Sun Jan 15 20:50:11 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 800BA1065673 for ; Sun, 15 Jan 2012 20:50:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 527DA8FC20 for ; Sun, 15 Jan 2012 20:50:11 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q0FKoB79029135 for ; Sun, 15 Jan 2012 20:50:11 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q0FKoBfj029134; Sun, 15 Jan 2012 20:50:11 GMT (envelope-from gnats) Resent-Date: Sun, 15 Jan 2012 20:50:11 GMT Resent-Message-Id: <201201152050.q0FKoBfj029134@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Srdjan Rosic Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 292301065670 for ; Sun, 15 Jan 2012 20:41:02 +0000 (UTC) (envelope-from srdjan.rosic@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id A78388FC20 for ; Sun, 15 Jan 2012 20:41:01 +0000 (UTC) Received: by werg1 with SMTP id g1so1079345wer.13 for ; Sun, 15 Jan 2012 12:41:00 -0800 (PST) Received: by 10.216.139.71 with SMTP id b49mr2495539wej.47.1326658611856; Sun, 15 Jan 2012 12:16:51 -0800 (PST) Received: from batou.dub.srdjanrosic.com (089-101-018145.ntlworld.ie. [89.101.18.145]) by mx.google.com with ESMTPS id f36sm19552259wbo.10.2012.01.15.12.16.49 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 15 Jan 2012 12:16:50 -0800 (PST) Received: by batou.dub.srdjanrosic.com (sSMTP sendmail emulation); Sun, 15 Jan 2012 20:16:47 +0000 Message-Id: <4f133432.6466e30a.3e78.ffffc4a2@mx.google.com> Date: Sun, 15 Jan 2012 20:16:47 +0000 From: "Charlie &" To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/164186: [patch] [ports] Improve www/fcgiwrap port with support for rc.d profiles. X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Srdjan Rosic List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Jan 2012 20:50:11 -0000 >Number: 164186 >Category: ports >Synopsis: [patch] [ports] Improve www/fcgiwrap port with support for rc.d profiles. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sun Jan 15 20:50:10 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Srdjan Rosic >Release: FreeBSD 8.2-STABLE amd64 >Organization: >Environment: >Description: Adds an easy way to run multiple fcgiwrap daemons, each with their own settings. The approach is analogous to the one nginx (www/nginx) uses. It also fixes a couple of small portlint issues. >How-To-Repeat: >Fix: Apply the attached patch. --- fcgiwrap.diff begins here --- diff --git a/www/fcgiwrap/Makefile b/www/fcgiwrap/Makefile index a942d1e..65d1cef 100644 --- a/www/fcgiwrap/Makefile +++ b/www/fcgiwrap/Makefile @@ -14,10 +14,11 @@ MASTER_SITES= http://cloud.github.com/downloads/gnosek/fcgiwrap/ MAINTAINER= bapt@FreeBSD.org COMMENT= Simple FastCGI wrapper for CGI scripts +LICENSE= MIT + LIB_DEPENDS= fcgi.0:${PORTSDIR}/www/fcgi WRKSRC= ${WRKDIR}/gnosek-fcgiwrap-2e301c8 -LICENSE= MIT USE_RC_SUBR= fcgiwrap diff --git a/www/fcgiwrap/files/fcgiwrap.in b/www/fcgiwrap/files/fcgiwrap.in index 5ee97a0..7bcd352 100755 --- a/www/fcgiwrap/files/fcgiwrap.in +++ b/www/fcgiwrap/files/fcgiwrap.in @@ -20,6 +20,21 @@ # - tcp6:[ipv6_addr]:port (for ipv6) # fcgiwrap_flags= # Use fcgiwrap_user to run fcgiwrap as user +# +# fcgiwrap rc.d script supports multiple profiles (a-la rc.d/nginx) +# When profiles are specified, the non-profile specific parameters become defaults. +# You need to make sure that no two profiles have the same socket parameter. +# +# Example: +# +# fcgiwrap_enable="YES" +# fcgiwrap_profiles="myserver myotherserver" +# fcgiwrap_flags="-c 4" +# fcgiwrap_myserver_socket="unix:/var/run/fcgiwrap.myserver.socket" +# fcgiwrap_myserver_user="myuser" +# fcgiwrap_myotherserver_socket="unix:/var/run/fcgiwrap.myotherserver.socket" +# fcgiwrap_myotherserver_user="myotheruser" +# fcgiwrap_myotherserver_flags="" # No flags for this profile. . /etc/rc.subr @@ -40,7 +55,7 @@ fcgiwrap_setfib() { fcgiwrap_precmd() { fcgiwrap_setfib - install -d -o $fcgiwrap_user -m 755 /var/run/fcgiwrap + install -d -o root -g wheel -m 1777 /var/run/fcgiwrap } fcgiwrap_cleansocket() { @@ -53,7 +68,8 @@ fcgiwrap_cleansocket() { rm -f $pidfile } -pidfile="/var/run/fcgiwrap/fcgiwrap.pid" +pidprefix="/var/run/fcgiwrap/fcgiwrap" +pidfile="${pidprefix}.pid" # May be a different path if profiles are in use. procname="%%PREFIX%%/sbin/${name}" command="/usr/sbin/daemon" @@ -62,11 +78,42 @@ stop_postcmd="fcgiwrap_cleansocket" load_rc_config $name +# These are just the defaults, they might get overriden for a specific profile. fcgiwrap_enable=${fcgiwrap_enable:-"NO"} fcgiwrap_fib=${fcgiwrap_fib:-"NONE"} fcgiwrap_user=${fcgiwrap_user:-"root"} fcgiwrap_socket=${fcgiwrap_socket:-"unix:/var/run/fcgiwrap/fcgiwrap.sock"} +# This handles profile specific vars. +if [ -n "$2" ]; then + profile="$2" + if [ -n "${fcgiwrap_profiles}" ]; then + pidfile="${pidprefix}.${profile}.pid" + eval fcgiwrap_enable="\${fcgiwrap_${profile}_enable:-${fcgiwrap_enable}}" + eval fcgiwrap_fib="\${fcgiwrap_${profile}_fib:-${fcgiwrap_fib}}" + eval fcgiwrap_user="\${fcgiwrap_${profile}_user:-${fcgiwrap_user}}" + eval fcgiwrap_socket="\${fcgiwrap_${profile}_socket:?}" + eval fcgiwrap_flags="\${fcgiwrap_${profile}_flags:-${fciwrap_flags}}" + else + echo "$0: extra argument ignored" + fi +else + if [ -n "${fcgiwrap_profiles}" -a -n "$1" ]; then + for profile in ${fcgiwrap_profiles}; do + echo "===> fcgiwrap profile: ${profile}" + /usr/local/etc/rc.d/fcgiwrap $1 ${profile} + retcode="$?" + if [ "0${retcode}" -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + # It exits so that non-profile rc.d is not started when there are profiles. + exit 0 + fi +fi + command_args="-f -p ${pidfile} ${procname} -s ${fcgiwrap_socket}" run_rc_command "$1" --- fcgiwrap.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: