| 1 | package App::Acmeman::Apache::Layout::debian; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use Carp; | ||
| 5 | use parent 'App::Acmeman::Apache::Layout'; | ||
| 6 | use File::Basename; | ||
| 7 | |||
| 8 | our $PRIORITY = 20; | ||
| 9 | |||
| 10 | sub new { | ||
| 11 | my $class = shift; | ||
| 12 | my $ap = shift; | ||
| 13 | |||
| 14 | if ($ap->server_config eq '/etc/apache2/apache2.conf') { | ||
| 15 | return $class->SUPER::new($ap, | ||
| 16 | restart_command => '/usr/sbin/service apache2 restart' | ||
| 17 | ); | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | sub incdir { | ||
| 22 | for my $dir ('/etc/apache2/conf-available', '/etc/apache2/conf.d') { | ||
| 23 | return $dir if -d $dir; | ||
| 24 | } | ||
| 25 | carp 'none of the expected configuration directories found; falling back to /etc/apache2'; | ||
| 26 | return '/etc/apache2'; | ||
| 27 | } | ||
| 28 | |||
| 29 | sub post_setup { | ||
| 30 | my ($self,$filename) = @_; | ||
| 31 | my $dir = dirname($filename); | ||
| 32 | my $name = basename($filename); | ||
| 33 | |||
| 34 | unless ($self->apache_modules('macro')) { | ||
| 35 | system("a2enmod macro"); | ||
| 36 | $self->apache_modules(undef); | ||
| 37 | } | ||
| 38 | if ($dir eq '/etc/apache2/conf-available') { | ||
| 39 | chdir('/etc/apache2/conf-enabled'); | ||
| 40 | symlink "../conf-available/$name", $name; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | 1; |