Mail-Toaster
view release on metacpan or search on metacpan
lib/Mail/Toaster/Setup.pm view on Meta::CPAN
print
"autorespond: port install failed, attempting to install from source.\n";
$ver = "2.0.5";
}
my @targets = ( 'make', 'make install' );
if ( $OSNAME eq "darwin" || $OSNAME eq "freebsd" ) {
print "autorespond: applying strcasestr patch.\n";
my $sed = $self->util->find_bin( "sed", verbose => 0 );
my $prefix = $self->conf->{toaster_prefix} || "/usr/local";
$prefix =~ s/\//\\\//g;
@targets = (
"$sed -i '' 's/strcasestr/strcasestr2/g' autorespond.c",
"$sed -i '' 's/PREFIX=\$(DESTDIR)\\/usr/PREFIX=\$(DESTDIR)$prefix/g' Makefile",
'make', 'make install'
);
}
$self->util->install_from_source(
package => "autorespond-$ver",
site => 'http://www.inter7.com',
url => '/devel',
targets => \@targets,
bintest => 'autorespond',
source_sub_dir => 'mail',
);
if ( $self->util->find_bin( "autorespond", fatal => 0, verbose => 0, ) ) {
$self->audit( "autorespond: installed ok" );
return 1;
}
return 0;
}
sub clamav {
my $self = shift;
my %p = validate( @_, { $self->get_std_opts } );
return $p{test_ok} if defined $p{test_ok}; # for testing
my $prefix = $self->conf->{toaster_prefix} || "/usr/local";
my $confdir = $self->conf->{system_config_dir} || "/usr/local/etc";
my $share = "$prefix/share/clamav";
my $clamuser = $self->conf->{install_clamav_user} || "clamav";
my $ver = $self->conf->{install_clamav} or do {
$self->audit( "clamav: installing, skipping (disabled)" );
return;
};
my $installed;
# install via ports if selected
if ( $OSNAME eq "freebsd" && $ver eq "port" ) {
$self->freebsd->install_port( "clamav", flags => "BATCH=yes WITHOUT_LDAP=1");
return $self->clamav_post_install;
}
# add the clamav user and group
unless ( getpwuid($clamuser) ) {
$self->group_add( 'clamav', '90' );
$self->user_add( $clamuser, 90, 90 );
}
unless ( getpwnam($clamuser) ) {
print "User clamav user installation FAILED, I cannot continue!\n";
return 0;
}
# install via ports if selected
if ( $OSNAME eq "darwin" && $ver eq "port" ) {
$self->darwin->install_port( "clamav" ) or return;
return $self->clamav_post_install;
}
# port installs didn't work out, time to build from sources
# set a default version of ClamAV if not provided
if ( $ver eq "1" ) { $ver = "0.97.8"; }; # latest as of 6/2013
# download the sources, build, and install ClamAV
$self->util->install_from_source(
package => 'clamav-' . $ver,
site => 'http://' . $self->conf->{toaster_sf_mirror},
url => '/clamav',
targets => [ './configure', 'make', 'make install' ],
bintest => 'clamdscan',
source_sub_dir => 'mail',
);
$self->util->find_bin( "clamdscan", fatal => 0 ) or
return $self->error( "clamav: install FAILED" );
$self->audit( "clamav: installed ok" );
return $self->clamav_post_install;
}
sub clamav_post_install {
my $self = shift;
my %p = validate( @_, { $self->get_std_opts } );
$self->clamav_update or return;
$self->clamav_perms or return;
$self->clamav_start or return;
return 1;
}
sub clamav_perms {
my $self = shift;
my %p = validate( @_, { $self->get_std_opts } );
my $prefix = $self->conf->{toaster_prefix} || "/usr/local";
my $confdir = $self->conf->{system_config_dir} || "/usr/local/etc";
my $clamuid = $self->conf->{install_clamav_user} || "clamav";
my $share = "$prefix/share/clamav";
foreach my $file ( $share, "$share/daily.cvd", "$share/main.cvd",
"$share/viruses.db", "$share/viruses.db2", "/var/log/clamav/freshclam.log", ) {
( run in 1.920 second using v1.01-cache-2.11-cpan-39bf76dae61 )