aboutsummaryrefslogtreecommitdiff
path: root/lib/App/Acmeman/Apache/Layout/debian.pm
blob: 663883ef6770e6f3e95320d91a94ccae6f2ce958 (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
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);

    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.