diff options
-rwxr-xr-x | postfix_wizard/Postfix.pm | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm index 8adf487e..c56a517f 100755 --- a/postfix_wizard/Postfix.pm +++ b/postfix_wizard/Postfix.pm @@ -21,6 +21,7 @@ package MDK::Wizard::Postfix; use strict; +use lib qw(/usr/lib/libDrakX); # required for service package use common; use MDK::Wizard::Wizcommon; @@ -39,68 +40,68 @@ my $o = { $o->{pages} = { welcome => { - name => N('Internet Mail Configuration Wizard') . "\n\n" . N('This wizard will help you configuring the Internet Mail services for your network.'), + 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 => 'config' }, config => { - name => N('Outgoing Mail Address') . "\n\n" . N('You can select the kind of address that outgoing mail will show in the \qFrom:\q and \qReply-to\q field.') . "\n\n" . N('This should be chosen consistently with the address you use for incoming mail.'), + name => N("Outgoing Mail Address") . "\n\n" . N("You can select the kind of address that outgoing mail will show in the \qFrom:\q and \qReply-to\q field.") . "\n\n" . N("This should be chosen consistently with the address you use for incoming mail."), pre => sub { $o->{var}{wiz_mail_masquerade} ||= get_mail_masquerade(); }, post => \&check_masquerade, data => [ { label => '' }, - { label => N('Mail Address:'), val => \$o->{var}{wiz_mail_masquerade} }, + { label => N("Mail Address:"), val => \$o->{var}{wiz_mail_masquerade} }, ], next => 'isp' }, warning => { - name => N('Warning:'), + name => N("Warning:"), data => [ - { label => N('You entered an empty address for the mail gateway.') }, - { label => N('') }, - { label => N('Your choice can be accepted, but this will not allow you to send mail outside your local network. Press next to continue, or back to enter a value.') } + { label => N("You entered an empty address for the mail gateway.") }, + { label => "" }, + { label => N("Your choice can be accepted, but this will not allow you to send mail outside your local network. Press next to continue, or back to enter a value.") } ], next => 'summary' }, masquerade_not_good => { - name => N('Error.'), - data => [ { label => N('Masquerade not good!') } ], + name => N("Error."), + data => [ { label => N("Masquerade not good!") } ], next => 'config' }, 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 \qhost.domain.domaintype\q; for example, if your provider is \qprovider.com\q, the internet mail server is usually \qsmtp.provider.com\q.'), + 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 \qhost.domain.domaintype\q; for example, if your provider is \qprovider.com\q, the internet mail server is usually \qsmtp.provider.com\q."), pre => sub { $o->{var}{wiz_ext_mail_relay} ||= get_mail_relay(); }, post => \&check_relay, data => [ { label => '' }, - { label => N('Mail Server Name:'), val => \$o->{var}{wiz_ext_mail_relay} }, + { label => N("Mail Server Name:"), val => \$o->{var}{wiz_ext_mail_relay} }, ], next => 'summary' }, summary => { - name => N('Configuring the Internet Mail') . "\n\n" . N('The wizard collected the following parameters needed to configure your Internet Mail Service:') . "\n\n" . N('To accept these values, and configure your server, click the Next button or use the Back button to correct them.'), + name => N("Configuring the Internet Mail") . "\n\n" . N("The wizard collected the following parameters needed to configure your Internet Mail Service:") . "\n\n" . N("To accept these values, and configure your server, click the Next button or use the Back button to correct them."), data => [ - { label => N('Internet Mail Gateway'), fixed_val => \$o->{var}{wiz_ext_mail_relay} }, + { label => N("Internet Mail Gateway"), fixed_val => \$o->{var}{wiz_ext_mail_relay} }, { label => '' }, - { label => N('Form of the Address'), fixed_val => \$o->{var}{wiz_mail_masquerade} }, + { label => N("Form of the Address"), fixed_val => \$o->{var}{wiz_mail_masquerade} }, ], post => \&do_it, next => 'end' }, end => { - name => N('Congratulation'), - data => [ { label => N('The wizard successfully configured your Internet Mail service of your server.') } ], + name => N("Congratulation"), + data => [ { label => N("The wizard successfully configured your Internet Mail service of your server.") } ], end => 1, next => 0 }, }; sub new { - my ($class, $conf) = @_; + my ($class, $_conf) = @_; bless { o => $o, }, $class; @@ -141,7 +142,7 @@ sub do_it { /etc/postfix/master.cf /etc/postfix/virtual); foreach (@conf) { - (-f $_) and MDK::Common::cp_af($_, $_.".orig"); + -f $_ and MDK::Common::cp_af($_, $_.".orig"); } @conf = ("myhostname = $wiz_host_name", 'myorigin = $mydomain', @@ -155,25 +156,26 @@ sub do_it { "relayhost = $o->{var}{wiz_ext_mail_relay}" ); foreach (@conf) { - system("/usr/sbin/postconf -e \'$_\'"); + system("/usr/sbin/postconf -e '$_'"); } if (defined $o->{var}{wiz_ext_mail_relay}) { my $file = "/etc/postfix/canonical"; my $canon = "\n\@$wiz_domain_name $o->{var}{wiz_mail_masquerade}"; my $t; foreach (cat_($file)) { - if (/^\s*(?!\#)\s*\@$wiz_domain_name.*/) { + if (/^\s*(?!#)\s*\@$wiz_domain_name/) { $t = $_; last; } } - if ($t) { substInFile { s|$t|\#$&$canon|} $file } + if ($t) { substInFile { s|$t|#$&$canon| } $file } else { append_to_file($file, $canon) } } system("/usr/sbin/postmap /etc/postfix/canonical"); system("/usr/sbin/postmap /etc/postfix/virtual"); system("/usr/sbin/postalias /etc/postfix/aliases"); system("/usr/sbin/postfix check"); + require services; if (services::is_service_running('postfix')) { services::restart('postfix') } else { |