diff options
-rwxr-xr-x | postfix_wizard/Postfix.pm | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index cddd17ee..b03c070c 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -32,6 +32,8 @@ my $wiz = new MDK::Wizard::Wizcommon; my $wiz_domain_name = $wiz->{net}->network_get("DOMAINNAME"); my $wiz_host_name = $wiz->{net}->network_get("HOSTNAME"); + + my $o = { name => N("Postfix wizard"), var => { @@ -48,7 +50,8 @@ $o->{pages} = { name => N("Internet Mail Configuration Wizard") . "\n\n" . N("This wizard will help you configuring the Internet Mail services for your network."), no_back => 1, next => 'isp', - next => 'config' + next => 'config', + post => \&check_sendmail, }, config => { name => N("Outgoing Mail Address") . "\n\n" . N("You can select the kind of address that outgoing mail will show in the \"From:\" and \"Reply-to\" field.") . "\n\n" . N("This should be chosen consistently with the address you use for incoming mail."), @@ -69,6 +72,12 @@ $o->{pages} = { name => N("Error.") . "\n\n" . N("Masquerade not good!"), next => 'config' }, + error_sendmail => { + name => N("Error, sendmail is installed, please remove it before install and configure Postfix"), + no_back => 1, + next => 0, + end => 1, + }, isp => { name => N("Internet Mail Gateway") . "\n\n" . N("Your server will send the outgoing through a mail gateway, that will take care of the final delivery.") . "\n\n" . N("Internet host names must be in the form \"host.domain.domaintype\"; for example, if your provider is \"provider.com\", the internet mail server is usually \"smtp.provider.com\"."), pre => sub { @@ -114,6 +123,14 @@ sub new { }, $class; } +sub check_sendmail { + my $in = 'interactive'->vnew('su', 'Check sendmail'); + my $w = $in->wait_message(N("Postfix Server"), N("Check if sendmail is installed....")); + my $test = grep { /sendmail/ } system("rpm -qa sendmail"); + !$test or return 'error_sendmail'; + undef $w; +} + sub check_masquerade { $o->{var}{wiz_mail_masquerade} or return 'masquerade_not_good'; $o->{var}{wiz_mail_masquerade} =~ /\w+\.\w+$/ or return 'masquerade_not_good'; @@ -165,10 +182,18 @@ sub do_it { 'alias_database = hash:/etc/postfix/aliases', 'virtual_maps = hash:/etc/postfix/virtual', 'canonical_maps = hash:/etc/postfix/canonical', - 'masquerade_domains = $mydomain', + "mydomain = $o->{var}{wiz_domain_name}", "relayhost = $o->{var}{wiz_ext_mail_relay}", - "myorigin = $o->{var}{wiz_myorigin}", ); + +# "myorigin = $o->{var}{wiz_myorigin}", +# "masquerade_domains = $o->{var}{wiz_mail_masquerade}", +# example of internal mail working confoguration +#myhostname = xp2400.guibland.com +#virtual_maps = hash:/etc/postfix/virtual +#canonical_maps = hash:/etc/postfix/canonical +#masquerade_domains = guibland.com + foreach (@conf) { system("/usr/sbin/postconf -e '$_'"); } @@ -191,7 +216,7 @@ sub do_it { system("/usr/sbin/postfix check"); require services; if (services::is_service_running('postfix')) { - services::restart('postfix') + services::restart('postfix') } else { services::start('postfix') } |