summaryrefslogtreecommitdiffstats
path: root/postfix_wizard
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2004-01-13 09:13:29 +0000
committerAntoine Ginies <aginies@mandriva.com>2004-01-13 09:13:29 +0000
commit68aa14fa39de9172cc9b98da7abffedca861c1ed (patch)
tree2ff3385b1532c36bfafe5998bca70a20318d7af7 /postfix_wizard
parent0b85743ade17b4b70d71c0aee09dd5c6c681e672 (diff)
downloaddrakwizard-68aa14fa39de9172cc9b98da7abffedca861c1ed.tar
drakwizard-68aa14fa39de9172cc9b98da7abffedca861c1ed.tar.gz
drakwizard-68aa14fa39de9172cc9b98da7abffedca861c1ed.tar.bz2
drakwizard-68aa14fa39de9172cc9b98da7abffedca861c1ed.tar.xz
drakwizard-68aa14fa39de9172cc9b98da7abffedca861c1ed.zip
add wiating dialog box, and myorigin var
Diffstat (limited to 'postfix_wizard')
-rwxr-xr-xpostfix_wizard/Postfix.pm178
1 files changed, 100 insertions, 78 deletions
diff --git a/postfix_wizard/Postfix.pm b/postfix_wizard/Postfix.pm
index 9e40c813..0fd2a328 100755
--- a/postfix_wizard/Postfix.pm
+++ b/postfix_wizard/Postfix.pm
@@ -33,66 +33,79 @@ 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 => {
- wiz_mail_masquerade => '',
- wiz_ext_mail_relay => ''
- },
- needed_rpm => [ 'postfix' ],
- defaultimage => "$ENV{__WIZ_HOME__}postfix_wizard/images/courrier.png"
- };
+ name => N("Postfix wizard"),
+ var => {
+ wiz_mail_masquerade => '',
+ wiz_ext_mail_relay => '',
+ wiz_myorigin => $wiz_domain_name,
+ },
+ needed_rpm => [ 'postfix' ],
+ defaultimage => "$ENV{__WIZ_HOME__}postfix_wizard/images/courrier.png"
+ };
$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."),
- 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 \"From:\" and \"Reply-to\" 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 => N("Masquerade domain name:"), val => \$o->{var}{wiz_mail_masquerade} },
- ],
- next => 'isp'
- },
- warning => {
- name => N("Warning:") . "\n\n" . N("You entered an empty address for the mail gateway.") . "\n\n" . 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.") . "\n\n" . 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 \"host.domain.domaintype\"; for example, if your provider is \"provider.com\", the internet mail server is usually \"smtp.provider.com\"."),
- pre => sub {
- $o->{var}{wiz_ext_mail_relay} ||= get_mail_relay();
- },
- post => \&check_relay,
- data => [
- { 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."),
- data => [
- { label => N("Internet Mail Gateway"), fixed_val => \$o->{var}{wiz_ext_mail_relay} },
- { label => N("Form of the Address"), fixed_val => \$o->{var}{wiz_mail_masquerade} },
- ],
- post => \&do_it,
- next => 'end'
- },
- end => {
- name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Internet Mail service of your server."),
- end => 1,
- next => 0
- },
-};
+ welcome => {
+ 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'
+ },
+ 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."),
+ pre => sub {
+ $o->{var}{wiz_mail_masquerade} ||= get_mail_masquerade();
+ },
+ post => \&check_masquerade,
+ data => [
+ { label => N("Masquerade domain name:"), val => \$o->{var}{wiz_mail_masquerade} },
+ ],
+ next => 'isp'
+ },
+ warning => {
+ name => N("Warning:") . "\n\n" . N("You entered an empty address for the mail gateway.") . "\n\n" . 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.") . "\n\n" . 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 \"host.domain.domaintype\"; for example, if your provider is \"provider.com\", the internet mail server is usually \"smtp.provider.com\"."),
+ pre => sub {
+ $o->{var}{wiz_ext_mail_relay} ||= get_mail_relay();
+ },
+ post => \&check_relay,
+ data => [
+ { label => N("Mail Server Name:"), val => \$o->{var}{wiz_ext_mail_relay} },
+ ],
+ next => 'origin'
+ },
+ origin => {
+ name => N("The myorigin parameter specifies the domain that locally-posted mail appears to come from") . "\n\n" . N("The default is to append \$myhostname which is fine for small sites."),
+ pre => sub {
+ $o->{var}{wiz_myorigin} ||= get_myorigin();
+ },
+ data => [
+ { label => N("myorigin:"), val => \$o->{var}{wiz_myorigin} },
+ ],
+ 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."),
+ data => [
+ { label => N("Internet Mail Gateway"), fixed_val => \$o->{var}{wiz_ext_mail_relay} },
+ { label => N("Form of the Address"), fixed_val => \$o->{var}{wiz_mail_masquerade} },
+ { label => N("myorigin"), fixed_val => \$o->{var}{wiz_myorigin} },
+ ],
+ post => \&do_it,
+ next => 'end'
+ },
+ end => {
+ name => N("Congratulations") . "\n\n" . N("The wizard successfully configured your Internet Mail service of your server."),
+ end => 1,
+ next => 0
+ },
+ };
sub new {
my ($class, $_conf) = @_;
@@ -126,9 +139,17 @@ sub get_mail_relay {
$relayhost;
}
+sub get_myorigin {
+ my $myorigin = `/usr/sbin/postconf -h myorigin`;
+ chomp $myorigin;
+ $myorigin;
+}
+
sub do_it {
- $::testing and return
- my @conf = qw(/etc/postfix/aliases
+ $::testing and return;
+ my $in = 'interactive'->vnew('su', 'postfix configuration');
+ my $w = $in->wait_message(N("Postfix Server"), N("Configuring your Postfix server."));
+ my @conf = qw(/etc/postfix/aliases
/etc/postfix/canonical
/etc/postfix/main.cf
/etc/postfix/master.cf
@@ -136,19 +157,20 @@ sub do_it {
foreach (@conf) {
-f $_ and MDK::Common::cp_af($_, $_.".orig");
}
+
@conf = ("myhostname = $wiz_host_name",
- 'myorigin = $mydomain',
- 'inet_interfaces = all',
+ 'inet_interfaces = $myhostname',
'mydestination = $myhostname, localhost.$mydomain',
- 'masquerade_domains = $mydomain',
'alias_maps = hash:/etc/postfix/aliases',
'alias_database = hash:/etc/postfix/aliases',
'virtual_maps = hash:/etc/postfix/virtual',
'canonical_maps = hash:/etc/postfix/canonical',
- "relayhost = $o->{var}{wiz_ext_mail_relay}"
+ 'masquerade_domains = $mydomain',
+ "relayhost = $o->{var}{wiz_ext_mail_relay}",
+ "myorigin = $o->{var}{wiz_myorigin}",
);
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";
@@ -160,20 +182,20 @@ sub do_it {
last;
}
}
- 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')
+ if ($t) { substInFile { s|$t|| } }
+ else { append_to_file($file, $canon)}
+ }
+ system("/usr/sbin/postmap -r -w /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 {
- services::start('postfix')
- }
- services::is_service_running('xinetd') and services::restart('xinetd');
+ services::start('postfix')
+ }
+ undef $w;
}
1;