aboutsummaryrefslogtreecommitdiff
path: root/lib/App/Acmeman/Apache/Layout/debian.pm
blob: c74092505763e56b53ed8c14d08b33c836fd12fe (plain)
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
package App::Acmeman::Apache::Layout::debian;
use strict;
use warnings;
use Carp;
use parent 'App::Acmeman::Apache::Layout';
use File::Basename;

our $PRIORITY = 20;

sub new {
    my $class = shift;
    my $ap = shift;

    if ($ap->server_config eq '/etc/apache2/apache2.conf') {
	return $class->SUPER::new($ap,
		     restart_command => '/usr/sbin/service apache2 restart'
	       );
    }
}

sub incdir {
    for my $dir ('/etc/apache2/conf-available', '/etc/apache2/conf.d') {
	return $dir if -d $dir;
    }
    carp 'none of the expected configuration directories found; falling back to /etc/apache2';
    return '/etc/apache2';
}

sub post_setup {
    my ($self,$filename) = @_;
    my $dir = dirname($filename);
    my $name = basename($filename);

    unless ($self->apache_modules('macro')) {
	system("a2enmod macro");
	$self->apache_modules(undef);
    }
    if ($dir eq '/etc/apache2/conf-available') {
	chdir('/etc/apache2/conf-enabled');
	symlink "../conf-available/$name", $name;
    }
}

1;

Return to:

Send suggestions and report system problems to the System administrator.