From b67289a14d0d890760edd373e07b1dfbefd433bd Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Wed, 30 Apr 2008 20:40:06 +0000 Subject: [PATCH] Ubuntu 8.04 fixes --- apache/CHANGELOG | 2 ++ apache/apache-lib.pl | 45 ++++++++++++++++++++++++-------- apache/config-debian-linux-3.1-* | 2 ++ 3 files changed, 38 insertions(+), 11 deletions(-) diff --git a/apache/CHANGELOG b/apache/CHANGELOG index 2931d5482..a716130c3 100644 --- a/apache/CHANGELOG +++ b/apache/CHANGELOG @@ -37,3 +37,5 @@ On Debian and Ubuntu systems, replaced the existing pages for selecting Apache m Available Apache modules are now fully automatically detected on all operating systems, which does away with the Re-Configure Known Modules page. ---- Changes since 1.400 ---- Moved the SSL password option to the global settings level, to correspond with the way Apache expects it. +---- Changes since 1.410 ---- +Added support for the funny ${APACHE_RUN_USER} and ${APACHE_PID_FILE} variables seen in apache2.conf on Ubuntu 8.04. diff --git a/apache/apache-lib.pl b/apache/apache-lib.pl index 5bcebb0b8..e04666f53 100644 --- a/apache/apache-lib.pl +++ b/apache/apache-lib.pl @@ -95,7 +95,15 @@ $dummy{'file'} = $_[2]; $dummy{'type'} = 0; $dummy{'name'} = "dummy"; @rv = (\%dummy); -local %defs = map { $_, 1 } &get_httpd_defines(); +local %defs; +foreach my $d (&get_httpd_defines()) { + if ($d =~ /^(\S+)=(.*)$/) { + $defs{$1} = $2; + } + else { + $defs{$d} = ''; + } + } while($line = <$fh>) { chop; $line =~ s/^\s*#.*$//g; @@ -143,8 +151,8 @@ while($line = <$fh>) { local $oldline = $_[1]; $_[1]++; local @dirs = &parse_config_file($fh, $_[1], $_[2], 'IfDefine'); - if (!$not && $defs{$def} || - $not && !$defs{$def}) { + if (!$not && defined($defs{$def}) || + $not && !defined($defs{$def})) { # use the directives.. push(@rv, { 'line', $oldline, 'eline', $oldline, @@ -242,6 +250,13 @@ while($line = <$fh>) { } } $dir{'value'} =~ s/\s+$//g; + if ($dir{'value'} =~ /^(.*)\$\{([^\}]+)\}(.*)$/) { + # Contains a variable .. replace with define + local $v = $defs{$2}; + if ($v) { + $dir{'value'} = $1.$v.$3; + } + } $dir{'words'} = &wsplit($dir{'value'}); push(@rv, \%dir); $_[1]++; @@ -1616,18 +1631,26 @@ if (!$auto) { push(@rv, keys %httpd_defines); } if ($config{'defines_file'}) { - # Add defines from an environment file + # Add defines from an environment file, which can be in + # the format : + # OPTIONS='-Dfoo -Dbar' + # or regular name=value format local %def; &read_env_file($config{'defines_file'}, \%def); - local $var = $def{$config{'defines_name'}}; - foreach my $v (split(/\s+/, $var)) { - if ($v =~ /^-[Dd](\S+)$/) { - push(@rv, $1); - } - else { - push(@rv, $v); + if ($config{'defines_name'}) { + local $var = $def{$config{'defines_name'}}; + foreach my $v (split(/\s+/, $var)) { + if ($v =~ /^-[Dd](\S+)$/) { + push(@rv, $1); + } + else { + push(@rv, $v); + } } } + else { + push(@rv, map { $_."=".$def{$_} } keys %def); + } } foreach my $md (split(/\t+/, $config{'defines_mods'})) { # Add HAVE_ defines from modules diff --git a/apache/config-debian-linux-3.1-* b/apache/config-debian-linux-3.1-* index f764b6b17..727a6fc0f 100644 --- a/apache/config-debian-linux-3.1-* +++ b/apache/config-debian-linux-3.1-* @@ -16,3 +16,5 @@ test_apachectl=1 virt_file=/etc/apache2/sites-available link_dir=/etc/apache2/sites-enabled auto_mods=1 +defines_file=/etc/apache2/envvars +apachectl_path=/usr/sbin/apache2ctl