diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-21 10:23:31 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-21 10:23:31 +0000 |
commit | 7dceec3516dd5ec91151891fb33fefe08fc5413d (patch) | |
tree | 7170d2ae72a943b160c231b8e1523e740d89f354 /postfix_wizard/scripts | |
parent | bed24014b9c572bcdadc9d62126a5682f08bdf0a (diff) | |
download | drakwizard-7dceec3516dd5ec91151891fb33fefe08fc5413d.tar drakwizard-7dceec3516dd5ec91151891fb33fefe08fc5413d.tar.gz drakwizard-7dceec3516dd5ec91151891fb33fefe08fc5413d.tar.bz2 drakwizard-7dceec3516dd5ec91151891fb33fefe08fc5413d.tar.xz drakwizard-7dceec3516dd5ec91151891fb33fefe08fc5413d.zip |
use of drakconnect db and bug fixes
Diffstat (limited to 'postfix_wizard/scripts')
-rw-r--r-- | postfix_wizard/scripts/Postfixconf.pm | 39 |
1 files changed, 15 insertions, 24 deletions
diff --git a/postfix_wizard/scripts/Postfixconf.pm b/postfix_wizard/scripts/Postfixconf.pm index 9ca428db..03c5658e 100644 --- a/postfix_wizard/scripts/Postfixconf.pm +++ b/postfix_wizard/scripts/Postfixconf.pm @@ -2,23 +2,15 @@ package Postfixconf; require "__WIZ_HOME__/common/scripts/Vareqval.pm"; +require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm"; use MDK::Common; use strict; +my $o = DrakconnectConf->new(); + 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 $wiz_domain_name = $o->get("DomainName"); + my $wiz_host_name = $o->get("SystemName"); my @conf = qw(/etc/postfix/aliases /etc/postfix/canonical /etc/postfix/main.cf @@ -27,7 +19,7 @@ sub do_it { foreach (@conf) { (-f $_) and MDK::Common::cp_af($_, $_.".orig"); } - @conf = ("myhostname = $wiz_host_name", + @conf = ("myhostname = $wiz_host_name.$wiz_domain_name", 'myorigin = $mydomain', 'inet_interfaces = all', 'mydestination = $myhostname, localhost.$mydomain, $mydomain', @@ -42,18 +34,17 @@ sub do_it { 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; + my $file = "/etc/postfix/canonical"; + my $canon = "\n\@$wiz_domain_name \@$ENV{wiz_mail_masquerade}"; + my $t; + foreach (cat_($file)) { + if (/^\s*(?!\#)\s*\@.*\@.*\@.*\..*/) { + $t = $_; + last; } } - close(CANONICAL); - open(CANONICAL, ">> $file"); - print CANONICAL "\n\@$ENV{wiz_domain_name} \@$ENV{wiz_mail_masquerade}"; - NOUPDATE: - close(CANONICAL); + if ($t) { substInFile { s|$t|\#$&$canon|} $file } + else { append_to_file($canon) } } system("postmap /etc/postfix/canonical"); system("postmap /etc/postfix/virtual"); |