diff options
author | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-21 15:45:15 +0000 |
---|---|---|
committer | Arnaud Desmons <adesmons@mandriva.com> | 2002-08-21 15:45:15 +0000 |
commit | e00efc0daf09e2c3078da363d9e25ee358c4357a (patch) | |
tree | cc029094478a5167e546f91b128d95ad6cfa2511 | |
parent | e748dceb1898f65ddcce9e8f16ccf16b689fabad (diff) | |
download | drakwizard-e00efc0daf09e2c3078da363d9e25ee358c4357a.tar drakwizard-e00efc0daf09e2c3078da363d9e25ee358c4357a.tar.gz drakwizard-e00efc0daf09e2c3078da363d9e25ee358c4357a.tar.bz2 drakwizard-e00efc0daf09e2c3078da363d9e25ee358c4357a.tar.xz drakwizard-e00efc0daf09e2c3078da363d9e25ee358c4357a.zip |
fillfunc added
-rwxr-xr-x | drakwizard.pl | 11 | ||||
-rw-r--r-- | postfix_wizard/scripts/Postfixconf.pm | 22 |
2 files changed, 30 insertions, 3 deletions
diff --git a/drakwizard.pl b/drakwizard.pl index 3fb49513..330c1904 100755 --- a/drakwizard.pl +++ b/drakwizard.pl @@ -67,7 +67,7 @@ my $o = []; $xmltree = XML::Parser->new(Style => 'Tree')->parsefile($ARGV[0]); get_parameter($o, $xmltree); -eval {navigation($o, $o->[0])}; +navigation($o, $o->[0]); $in->exit; @@ -143,6 +143,7 @@ sub get_parameter { : ($tag eq 'Boolean') ? 'bool' : ($leaf->{editable} eq 'true') ? 'entry' : 'field')}; + $leaf->{fillScript} =~ s/\\q/\"/g; }, Chooser => \&$common_freetext_chooser, Boolean => \&$common_freetext_chooser, @@ -201,6 +202,14 @@ sub display { @liste = @{$_->{Option}}; } } + if ($_->{main_order} eq 'entry' and $_->{fillScript}) { + $ENV{$variable{$_->{variableName}}} = `$_->{fillScript}`; + chomp($ENV{$variable{$_->{variableName}}}); + } + elsif (!$ENV{$variable{$_->{variableName}}} && $_->{main_order} eq 'entry' && $_->{fillfunc}) { + $ENV{$variable{$_->{variableName}}} = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->(); + chomp($ENV{$variable{$_->{variableName}}}); + } ($_->{main_order} eq 'entry') ? { label => translate($_->{helpText}), val => \$ENV{$variable{$_->{variableName}}}, type => $_->{main_order} } : ($_->{main_order} eq 'bool') ? { val => \$ENV{$variable{$_->{variableName}}}, type => $_->{main_order}, diff --git a/postfix_wizard/scripts/Postfixconf.pm b/postfix_wizard/scripts/Postfixconf.pm index 03c5658e..52cc13f2 100644 --- a/postfix_wizard/scripts/Postfixconf.pm +++ b/postfix_wizard/scripts/Postfixconf.pm @@ -7,9 +7,27 @@ use MDK::Common; use strict; my $o = DrakconnectConf->new(); +my $wiz_domain_name = $o->get("DomainName"); +my $wiz_host_name = $o->get("SystemName"); + +sub get_mail_masquerade { + my $login = `logname`; + my $relayhost = `postconf -h relayhost`; + chomp($relayhost); + ($relayhost) = $relayhost =~ /.*\.(.*\..*)/; + !length $relayhost and $relayhost = $wiz_domain_name; + chomp($login); + "$login\@$relayhost"; +} + +sub get_mail_relay { + my $relayhost = `postconf -h relayhost`; + chomp $relayhost; + !length $relayhost and $relayhost = "smtp.$wiz_domain_name"; + $relayhost; +} sub do_it { - my $wiz_domain_name = $o->get("DomainName"); my $wiz_host_name = $o->get("SystemName"); my @conf = qw(/etc/postfix/aliases /etc/postfix/canonical @@ -38,7 +56,7 @@ sub do_it { my $canon = "\n\@$wiz_domain_name \@$ENV{wiz_mail_masquerade}"; my $t; foreach (cat_($file)) { - if (/^\s*(?!\#)\s*\@.*\@.*\@.*\..*/) { + if (/^\s*(?!\#)\s*\@.*\@.*\@.*/) { $t = $_; last; } |