ports/116627: [patch] www/apache22: completely shut up rc.d script when no profiles are enabled

Eygene Ryabinkin rea-fbsd at codelabs.ru
Tue Sep 25 07:10:02 UTC 2007

>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:    freebsd-ports-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 25 07:10:01 GMT 2007
>Originator:     Eygene Ryabinkin
>Release:        FreeBSD 7.0-CURRENT i386
Code Labs

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


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.


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

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.


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 @@
 	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}
--- apache22.sh.in.respect-enable.patch ends here ---

More information about the freebsd-ports-bugs mailing list