Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Nov 2009 13:42:05 +1030 (CST)
From:      Jarrod Sayers <jarrod@netleader.com.au>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/140380: [patch] www/apache22: Add support for inclusion of profile_* directive
Message-ID:  <200911080312.nA83C5An031836@manhattan.downtools.com.au>
Resent-Message-ID: <200911080330.nA83U2ZJ069719@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         140380
>Category:       ports
>Synopsis:       [patch] www/apache22: Add support for inclusion of profile_* directive
>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 Nov 08 03:30:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Jarrod Sayers
>Release:        FreeBSD 7.2-RELEASE-p4 i386
>Organization:
>Environment:
System: FreeBSD manhattan.downtools.com.au 7.2-RELEASE-p4 FreeBSD 7.2-RELEASE-p4 #18: Sat Oct 3 19:20:23 CST 2009 root@manhattan.netleader.com.au:/usr/obj/usr/src/sys/MANHATTAN i386
>Description:
The www/apache22 port has support for multiple profiles which are controlled from
a single rc.d script.  However, in some instances multiple profiles share a common
base configuration or only differ by a few directives.  This patch adds support
for a new rc.conf flag, apache22_profile_directives, which when set adds an
additional directive to the command line specifying the name of the profile itself.

Consider the following example:

apache22_enable="YES"
apache22_profiles="httpd mail"
apache22_httpd_configfile="/usr/local/etc/apache22/httpd.manhattan.conf"
apache22_mail_configfile="/usr/local/etc/apache22/httpd.mail.conf"

The two configuration files only differ in a few places that define the Listen
address and ServerName, plus a Directory directive or two.  Due to the small
number of differences, these files could be collapsed in to one which
simplifies global level changes.

Consider the following modified example:

<IfDefine profile_httpd>
  Listen manhattan.downtools.com.au:80
  ServerName manhattan.downtools.com.au
  DocumentRoot /home/htdocs/default/data
</IfDefine>
<IfDefine profile_mail>
  Listen mail.downtools.com.au:443
  ServerName mail.downtools.com.au
  DocumentRoot /home/htdocs/mail/data
</IfDefine>

...

<IfDefine profile_mail>
  <Directory /usr/local/www/roundcube>
    ...
    SSLRequireSSL
  </Directory>
</IfDefine>

By collapsing the minor differences, both profiles can still be controlled
individually via the rc.d script as a -Dprofile_${profile} flag will be added
to the command line for each.  This results in a slightly simplified rc.conf
configuration and less duplication.

apache22_enable="YES"
apache22_profiles="httpd mail"
apache22_profile_directives="YES"
apache22_httpd_configfile="/usr/local/etc/apache22/httpd.manhattan.conf"
apache22_mail_configfile="${apache22_httpd_configfile}"
>How-To-Repeat:
>Fix:
--- www-apache22-apache22_profile_directives.diff begins here ---
diff -ruN ports/www/apache22.orig/Makefile ports/www/apache22/Makefile
--- ports/www/apache22.orig/Makefile	2009-09-16 23:47:57.000000000 +0930
+++ ports/www/apache22/Makefile	2009-11-08 12:11:56.000000000 +1030
@@ -9,6 +9,7 @@
 
 PORTNAME=	apache
 PORTVERSION=	2.2.13
+PORTREVISION=	1
 CATEGORIES=	www
 MASTER_SITES=	${MASTER_SITE_APACHE_HTTPD}
 DISTNAME=	httpd-${PORTVERSION}
diff -ruN ports/www/apache22.orig/files/apache22.in ports/www/apache22/files/apache22.in
--- ports/www/apache22.orig/files/apache22.in	2009-08-03 05:05:57.000000000 +0930
+++ ports/www/apache22/files/apache22.in	2009-11-08 12:31:27.000000000 +1030
@@ -13,6 +13,9 @@
 #                             Set it to "YES" to enable apache22
 # apache22_profiles (str):     Set to "" by default.
 #                              Define your profiles here.
+# apache22_profile_directives (bool): Set to "NO" by default.
+#                              Set to "YES" to include a profile_*
+#                              directive on the httpd command line.
 # apache22limits_enable (bool):Set to "NO" by default.
 #                             Set it to yes to run `limits $limits_args`
 #                             just before apache starts.
@@ -43,6 +46,7 @@
 required_files=%%PREFIX%%/etc/apache22/httpd.conf
 
 [ -z "$apache22_enable" ]       && apache22_enable="NO"
+[ -z "$apache22_profile_directives" ] && apache22_profile_directives="NO"
 [ -z "$apache22limits_enable" ] && apache22limits_enable="NO"
 [ -z "$apache22limits_args" ]   && apache22limits_args="-e -C daemon"
 [ -z "$apache22_http_accept_enable" ] && apache22_http_accept_enable="NO"
@@ -84,6 +88,13 @@
 		eval apache22limits_enable="\${apache22limits_${profile}_enable:-${apache22limits_enable}}"
 		eval apache22limits_args="\${apache22limits_${profile}_args:-${apache22limits_args}}"
 		eval apache22_fib="\${apache22_${profile}_fib:-${apache22_fib}}"
+		case "${apache22_profile_directives}" in
+			[Yy][Ee][Ss])
+				apache22_flags="-Dprofile_${profile} ${apache22_flags}"
+				;;
+			*)
+				;;
+		esac
 		apache22_flags="-f ${apache22_configfile} -c \"PidFile ${pidfile}\" ${apache22_flags}"
 	else
 		echo "$0: extra argument ignored"
--- www-apache22-apache22_profile_directives.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911080312.nA83C5An031836>