diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | dhcp_wizard/dhcp.wiz | 4 | ||||
-rw-r--r-- | dhcp_wizard/scripts/Dhcpconf.pm | 20 | ||||
-rwxr-xr-x | drakwizard.pl | 25 | ||||
-rw-r--r-- | firewall_wizard/firewall.wiz | 1 | ||||
-rw-r--r-- | proxy_wizard/proxy.wiz | 20 | ||||
-rw-r--r-- | proxy_wizard/scripts/Squidconf.pm | 28 | ||||
-rw-r--r-- | server_wizard/Makefile | 5 |
8 files changed, 72 insertions, 32 deletions
@@ -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 @@ <Freetext name="dhcpIpLow" variableName="dhcp_range_low" - fillScript="__WIZ_HOME__/dhcp_wizard/scripts/compute_range1.sh" + fillfunc="compute_range" helpText="Lowest IP Address:" editable="true" > @@ -99,7 +99,7 @@ <Freetext name="dhcpIpHigh" variableName="dhcp_range_high" - fillScript="__WIZ_HOME__/dhcp_wizard/scripts/compute_range2.sh" + fillfunc="compute_range2" helpText="Highest IP Address:" editable="true" > 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:" <Freetext name="freetext" variableName="protectionLevel" - fillScript="__WIZ_HOME__/firewall_wizard/scripts/compute_level_name.sh" helpText="Protection Level:" editable="false" > 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 @@ <Variable name="wiz_squid_port" shellVariable="wiz_squid_port" - defaultValue="3128" valueIsTranslated="false" + defaultValue="3128" > </Variable> @@ -47,7 +47,6 @@ <Variable name="wiz_squid_mynetw" shellVariable="wiz_squid_mynetw" - defaultValue="0.0.0.0/0.0.0.0" valueIsTranslated="false" > </Variable> @@ -112,7 +111,7 @@ <Page name="port" helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-proxy.html" - jumpScript="__WIZ_HOME__/proxy_wizard/scripts/testport.sh" + func="testport" executionLevel="NORMAL" nextFinish="false" canBack="true" @@ -150,7 +149,6 @@ <Freetext - name="wiz_squid_port" variableName="wiz_squid_port" helpText="Proxy port:" editable="true" @@ -315,18 +313,17 @@ helpText="You have entered a port that may be useful for this service:" > </Info> - - <Info - fillScript="__WIZ_HOME__/proxy_wizard/scripts/printservices.sh" + helpText="Press Next if you want to keep this value, or Back to correct your choice." > </Info> - - <Info - helpText="Press Next if you want to keep this value, or Back to correct your choice." + <Freetext + fillfunc="port" + helpText="/etc/services:" + editable="false" > - </Info> + </Freetext> </Page> <Page @@ -359,6 +356,7 @@ <Freetext name="f_wiz_squid_mynetw" variableName="wiz_squid_mynetw" + fillfunc="network_mask" helpText="Authorised network:" editable="true" > 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 |