diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-07-26 09:21:20 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-07-26 09:21:20 +0000 |
commit | 8713aefb261a6574396bc11929f8d445360c5ffd (patch) | |
tree | c219c63a160caf55644e68dfdc3b5b3338c6d322 /postfix_wizard | |
parent | 73b46aef2e46fbd345e1186dc28c33ac64283e0f (diff) | |
download | drakwizard-8713aefb261a6574396bc11929f8d445360c5ffd.tar drakwizard-8713aefb261a6574396bc11929f8d445360c5ffd.tar.gz drakwizard-8713aefb261a6574396bc11929f8d445360c5ffd.tar.bz2 drakwizard-8713aefb261a6574396bc11929f8d445360c5ffd.tar.xz drakwizard-8713aefb261a6574396bc11929f8d445360c5ffd.zip |
first perl traduction
Diffstat (limited to 'postfix_wizard')
-rw-r--r-- | postfix_wizard/scripts/Postfixconf.pm | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/postfix_wizard/scripts/Postfixconf.pm b/postfix_wizard/scripts/Postfixconf.pm new file mode 100644 index 00000000..a7733e8d --- /dev/null +++ b/postfix_wizard/scripts/Postfixconf.pm @@ -0,0 +1,65 @@ +#!/usr/bin/perl + +package Postfixconf; +require "__WIZ_HOME__/common/scripts/Vareqval.pm"; +use MDK::Common; +use strict; + +sub do_it { + my $file = "/etc/sysconfig/mdk_serv"; + my %mdk = Vareqval->get($file); + my $wiz_domain_name = $mdk{wiz_domain_name} if defined $mdk{wiz_domain_name} or + die "wiz_domain_name not in $file"; + my $wiz_host_name = $mdk{wiz_host_name} if defined $mdk{wiz_host_name} or + die "wiz_host_name not in $file"; + my $wiz_device = $mdk{wiz_device} if defined $mdk{wiz_device} or + die "wiz_device not in $file"; + $mdk{wiz_ext_mail_relay} = $ENV{wiz_ext_mail_relay} if defined $ENV{wiz_ext_mail_relay} or + die "wiz_ext_mail_relay not in env"; + $mdk{wiz_mail_masquerade} = $ENV{wiz_mail_masquerade} if defined $ENV{wiz_mail_masquerade} or + die "wiz_mail_masquerade not in env"; + Vareqval->commit($file, \%mdk); + my @conf = qw(/etc/postfix/aliases + /etc/postfix/canonical + /etc/postfix/main.cf + /etc/postfix/master.cf + /etc/postfix/virtual); + foreach (@conf) { + (-f $_) and MDK::Common::cp_af($_, $_.".orig"); + } + @conf = ("myhostname = $wiz_host_name", + 'myorigin = $mydomain', + 'inet_interfaces = all', + 'mydestination = $myhostname, localhost.$mydomain, $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 = $ENV{wiz_ext_mail_relay}" + ); + foreach (@conf) { + system("postconf -e \'$_\'"); + } + if (defined $ENV{wiz_ext_mail_relay}) { + $file = "/etc/postfix/canonical"; + open(CANONICAL, "< $file"); + while (<CANONICAL>) { + if (/\@$ENV{wiz_domain_name}\s*\@$ENV{wiz_mail_masquerade}/){ + goto NOUPDATE; + } + } + close(CANONICAL); + open(CANONICAL, ">> $file"); + print CANONICAL "\n\@$ENV{wiz_domain_name} \@$ENV{wiz_mail_masquerade}"; + NOUPDATE: + close(CANONICAL); + } + system("postmap /etc/postfix/canonical"); + system("postmap /etc/postfix/virtual"); + system("postalias /etc/postfix/aliases"); + system("postfix check"); + system("service postfix restart"); + system("service xinetd restart"); +} + |