From rea-fbsd@codelabs.ru  Tue Sep 25 07:02:27 2007
Return-Path: <rea-fbsd@codelabs.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 2DC3716A421
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 25 Sep 2007 07:02:27 +0000 (UTC)
	(envelope-from rea-fbsd@codelabs.ru)
Received: from pobox.codelabs.ru (pobox.codelabs.ru [144.206.177.45])
	by mx1.freebsd.org (Postfix) with ESMTP id C5E3A13C455
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 25 Sep 2007 07:02:26 +0000 (UTC)
	(envelope-from rea-fbsd@codelabs.ru)
Received: from void.codelabs.ru (void.codelabs.ru [144.206.177.25])
	by pobox.codelabs.ru with esmtps (TLSv1:CAMELLIA256-SHA:256)
	id 1Ia4R7-000LhF-RG; Tue, 25 Sep 2007 11:02:25 +0400
Message-Id: <20070925070225.57FB21AF41C@void.codelabs.ru>
Date: Tue, 25 Sep 2007 11:02:25 +0400 (MSD)
From: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
Reply-To: Eygene Ryabinkin <rea-fbsd@codelabs.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc: clement@FreeBSD.org
Subject: [patch] www/apache22: completely shut up rc.d script when no profiles are enabled
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         116627
>Category:       ports
>Synopsis:       [patch] www/apache22: completely shut up rc.d script when no profiles are enabled
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    clement
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 25 07:10:01 GMT 2007
>Closed-Date:    Tue Sep 02 07:41:32 UTC 2008
>Last-Modified:  Tue Sep 02 07:41:32 UTC 2008
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 7.0-CURRENT i386
>Organization:
Code Labs
>Environment:

System: FreeBSD XXX 7.0-CURRENT FreeBSD 7.0-CURRENT #10: Wed Sep 12 16:16:49 MSD 2007 root@XXX:/usr/src/sys/i386/compile/XXX i386

>Description:

If one has a number of Apache profiles, but has apache22_enable set
to NO, rc.d script still prints the names of the profiles (but, of
cource, does no further actions).  This is a bit annoying as it can
provoke the thoughts that something gone terribly wrong.

>How-To-Repeat:

Add a couple of Apache profiles, do not set individual values
for apache22_<profile>_enable and set apache22_enable to NO.
Run /usr/local/etc/rc.d/apache22 start and see the profile
banners.

The same effect can be achieved if not all apache22_<profile>_enable
are set to 'yes': rc.d script will still output names of all profiles.

>Fix:

The following patch fixes the situation.  Furthermore, it checks
the apache22*_enable values to be 'yes', 'no' or 'none' and issues
warning if some variable has the other value.

--- apache22.sh.in.respect-enable.patch begins here ---
--- apache22.sh.in.orig	2007-09-25 09:55:57.000000000 +0400
+++ apache22.sh.in	2007-09-25 10:54:20.000000000 +0400
@@ -89,6 +89,26 @@
 else
 	if [ "x${apache22_profiles}" != "x" -a "x$1" != "x" ]; then
 		for profile in ${apache22_profiles}; do
+			eval _enable="\${apache22_${profile}_enable}"
+			case "x${_enable:-${apache22_enable}}" in
+			x|x[Nn][Oo]|x[Nn][Oo][Nn][Ee])
+				continue
+				;;
+			x[Yy][Ee][Ss])
+				;;
+			*)
+				if test -z "$_enable"; then
+					_var=apache22_enable
+				else
+					_var=apache22_"${profile}"_enable
+				fi
+				echo "Bad value" \
+				    "'${_enable:-${apache22_enable}}'" \
+				    "for ${_var}. " \
+				    "Profile ${profile} skipped."
+				continue
+				;;
+			esac
 			echo "===> apache22 profile: ${profile}"
 			%%PREFIX%%/etc/rc.d/apache22%%RC_SUBR_SUFFIX%% $1 ${profile}
 			retcode="$?"
--- apache22.sh.in.respect-enable.patch ends here ---
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->clement 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Sep 25 07:10:12 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116627 
State-Changed-From-To: open->closed 
State-Changed-By: clement 
State-Changed-When: Tue Sep 2 07:41:13 UTC 2008 
State-Changed-Why:  
Patch committed, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116627 
>Unformatted:
