From 2a0c44a89ff2ebd4e3de5fa7e3cfc82c23706eff Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Tue, 3 Sep 2002 13:28:28 +0000 Subject: some fillfunc --- Makefile | 1 + dhcp_wizard/dhcp.wiz | 4 ++-- dhcp_wizard/scripts/Dhcpconf.pm | 20 +++++++++++++++++++- drakwizard.pl | 25 +++++++++++++------------ firewall_wizard/firewall.wiz | 1 - proxy_wizard/proxy.wiz | 20 +++++++++----------- proxy_wizard/scripts/Squidconf.pm | 28 ++++++++++++++++++++++++++++ server_wizard/Makefile | 5 ----- 8 files changed, 72 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 963605ea..c4480b1a 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ WIZ = common\ client_wizard\ db_wizard\ proxy_wizard\ + nfs_wizard\ data\ po diff --git a/dhcp_wizard/dhcp.wiz b/dhcp_wizard/dhcp.wiz index 7eee4efe..8a2d9ac3 100644 --- a/dhcp_wizard/dhcp.wiz +++ b/dhcp_wizard/dhcp.wiz @@ -90,7 +90,7 @@ @@ -99,7 +99,7 @@ diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm index ad34c59a..8fd15aef 100644 --- a/dhcp_wizard/scripts/Dhcpconf.pm +++ b/dhcp_wizard/scripts/Dhcpconf.pm @@ -26,9 +26,27 @@ use strict; use standalone; my $o = DrakconnectConf->new(); +my $wiz_ip_server = $o->get_from_known_dev("IP"); +my $d = "$4" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; +my $s = "$1.$2.$3" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; + +sub compute_range { + my $n; + if ($d <= 64) { $n = "65" } + elsif ($d <= 128) { $n = "129" } + else { $n = "1"} + "$s.$n"; +} + +sub compute_range2 { + my $n; + if ($d <= 128) { $n = "254" } + elsif ($d > 192) { $n = "192" } + else { $n = "128"} + "$s.$n"; +} sub do_it { - my $wiz_ip_server = $o->get_from_known_dev("IP"); my $wiz_domain_name = $o->get("DomainName"); my $wiz_host_name = $o->get("SystemName"); my $wiz_ip_net = "$1.$2.$3.0" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; diff --git a/drakwizard.pl b/drakwizard.pl index ac4389ff..d7899a33 100755 --- a/drakwizard.pl +++ b/drakwizard.pl @@ -47,14 +47,15 @@ if (!defined($ARGV[0])) { my %wiz = ( 1 => [$prefix."web_wizard/web.wiz", "Apache"], 2 => [$prefix."dhcp_wizard/dhcp.wiz", "Dhcp"], - 3 => [$prefix."dns_wizard/dns.wiz", "Dns"], - 4 => [$prefix."news_wizard/news.wiz", "News"], - 5 => [$prefix."nfs_wizard/nfs.wiz", "NFS"], - 6 => [$prefix."postfix_wizard/postfix.wiz", "Postfix"], - 7 => [$prefix."ftp_wizard/ftp.wiz", "Proftpd"], - 8 => [$prefix."samba_wizard/samba.wiz", "Samba"], - 9 => [$prefix."proxy_wizard/proxy.wiz", "Squid"], - 10 => [$prefix."time_wizard/time.wiz", "Time"] + 3 => [$prefix."dns_wizard/dns.wiz", "Dns (server)"], + 4 => [$prefix."client_wizard/client.wiz", "Dns (client)"], + 5 => [$prefix."news_wizard/news.wiz", "News"], + 6 => [$prefix."nfs_wizard/nfs.wiz", "NFS"], + 7 => [$prefix."postfix_wizard/postfix.wiz", "Postfix"], + 8 => [$prefix."ftp_wizard/ftp.wiz", "Proftpd"], + 9 => [$prefix."samba_wizard/samba.wiz", "Samba"], + 10 => [$prefix."proxy_wizard/proxy.wiz", "Squid"], + 11 => [$prefix."time_wizard/time.wiz", "Time"] ); $in->ask_from( _("Drakwizard wizard selection"), @@ -116,7 +117,7 @@ sub get_parameter { }, Variable => sub { $variable{$leaf->{name}} = $leaf->{shellVariable}; - $ENV{$leaf->{shellVariable}} = $leaf->{defaultValue}; + $ENV{$variable{$leaf->{name}}} = $leaf->{defaultValue}; }, Page => sub { !$welcome and $welcome = $page; @@ -153,7 +154,6 @@ 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, @@ -213,13 +213,14 @@ sub display { @liste = @{$_->{Option}}; } } - if ($_->{main_order} eq 'entry' and $_->{fillScript}) { + if ($_->{fillScript}) { $ENV{$variable{$_->{variableName}}} = `. $lib_script && $_->{fillScript}`; } - elsif (!$ENV{$variable{$_->{variableName}}} && $_->{main_order} eq 'entry' && $_->{fillfunc}) { + elsif (!$ENV{$variable{$_->{variableName}}} && $_->{fillfunc}) { $ENV{$variable{$_->{variableName}}} = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->(); } chomp($ENV{$variable{$_->{variableName}}}); + $ENV{$_->{variableName}} = $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/firewall_wizard/firewall.wiz b/firewall_wizard/firewall.wiz index 54d66431..3bda88dd 100644 --- a/firewall_wizard/firewall.wiz +++ b/firewall_wizard/firewall.wiz @@ -219,7 +219,6 @@ needed to configure your firewall:" diff --git a/proxy_wizard/proxy.wiz b/proxy_wizard/proxy.wiz index 16ec0be4..0d043688 100644 --- a/proxy_wizard/proxy.wiz +++ b/proxy_wizard/proxy.wiz @@ -23,8 +23,8 @@ @@ -47,7 +47,6 @@ @@ -112,7 +111,7 @@ - - - - - + diff --git a/proxy_wizard/scripts/Squidconf.pm b/proxy_wizard/scripts/Squidconf.pm index 4437e355..d9d1c103 100644 --- a/proxy_wizard/scripts/Squidconf.pm +++ b/proxy_wizard/scripts/Squidconf.pm @@ -3,10 +3,38 @@ package Squidconf; require "__WIZ_HOME__/common/scripts/Vareqval.pm"; require "__WIZ_HOME__/common/scripts/Varspaceval.pm"; +require "__WIZ_HOME__/common/scripts/DrakconnectConf.pm"; use MDK::Common; use strict; use standalone; +sub network_mask { + my $o = DrakconnectConf->new(); + my $wiz_ip_server = $o->get_from_known_dev("IP"); + my $mask = $o->get_from_known_dev("Mask"); + "$1.$2.$3.0/$mask" if $wiz_ip_server =~ /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/; +} + +sub testport { + if ($ENV{wiz_squid_port} == 3128 || $ENV{wiz_squid_port} == 8080) { + return 0; + } + elsif ($ENV{wiz_squid_port} <= 1024 || $ENV{wiz_squid_port} >= 65536) { + return 2; + } + 1; +} + +sub port { + my $ret; + my @lines = grep(/$ENV{wiz_squid_port}\/tcp/, cat_("/etc/services")); + foreach (@lines) { + s/\t/ /g; + $ret .= "\n$_"; + } + $ret; +} + sub do_it_squid { my $file="/etc/squid/squid.conf"; -f $file and MDK::Common::cp_af($file, $file.".orig"); diff --git a/server_wizard/Makefile b/server_wizard/Makefile index 506be383..5633aa06 100644 --- a/server_wizard/Makefile +++ b/server_wizard/Makefile @@ -7,11 +7,6 @@ install: mkdir -p --mode=u=rwx,g=rx,o=rx ${prefix}/share/wizards/server_wizard/scripts mkdir -p --mode=u=rwx,g=rx,o=rx ${prefix}/share/wizards/server_wizard/images install --mode=u=rw,g=r,o=r -p server.wiz ${prefix}/share/wizards/server_wizard - - - - - install --mode=a=r -p ./images/intranet.png ${prefix}/share/wizards/server_wizard/images install --mode=u=rwx,g=rx,o=rx -p scripts/*.sh ${prefix}/share/wizards/server_wizard/scripts install --mode=u=rw,g=r,o=r -p scripts/Serverconf.pm ${prefix}/share/wizards/server_wizard/scripts -- cgit v1.2.1