File: apache2.2-common.bug.script

package info (click to toggle)
apache2 2.2.9-10%2Blenny12
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 37,556 kB
  • ctags: 20,182
  • sloc: ansic: 221,847; sh: 20,216; perl: 2,094; makefile: 1,251; awk: 1,124; pascal: 513; lex: 191; python: 136; yacc: 100
file content (45 lines) | stat: -rw-r--r-- 1,246 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl -w

use strict;
use Text::Wrap;
$Text::Wrap::columns = 70;

open (my $out, ">&=3") or die "could not open FD 3\n";

my $apache = ". /etc/apache2/envvars && /usr/sbin/apache2";
my $res = `$apache -t 2>&1`;
my @modules;
if ($res !~ "Syntax OK") {
	# if we are not root, syntax check will fail because ssl private keys
	# are not readable
	print $out "Config file syntax check failed.\n" if $> == 0;
	@modules = sort glob("/etc/apache2/mods-enabled/*.load");
	map { s{^/etc/apache2/mods-enabled/(.*)\.load$}{$1} } @modules;
	print $out "List of /etc/apache2/mods-enabled/*.load:\n";
}
else {
	@modules = sort `$apache -M 2>&1`;
	@modules = map { /^ (.*)_module \(shared\)/ ? ($1) : () } @modules;
	print $out "List of enabled modules from 'apache2 -M':\n";
}
if (! scalar @modules) {
	print $out "Could not determine module list\n";
}
else {
	my $missing;
	foreach my $m (@modules) {
		if (-e "/etc/apache2/mods-available/$m.conf" and
		    ! -e "/etc/apache2/mods-enabled/$m.conf") {
			$m .= "*";
			$missing = 1;
		}
	}

	print $out wrap("  ", "  ", "@modules\n");

	print $out
	    wrap("  ", "   ", 
		"(A * means that the .conf file for that module is not " .
		"enabled in /etc/apache2/mods-enabled/)\n") 
	    if $missing;
}