From 83eca6fa0dac3c5dbf68aff23d87ff5fca2e5a5c Mon Sep 17 00:00:00 2001 From: Arnaud Desmons Date: Tue, 15 Oct 2002 16:10:00 +0000 Subject: wiz update, nfs fixed --- Makefile | 3 +- dhcp_wizard/scripts/Dhcpconf.pm | 7 ++- drakwizard.pl | 44 +++++++++--------- ftp_wizard/ftp.wiz | 76 +++++++++++++++++++++++++++++-- ftp_wizard/scripts/ProFtpconf.pm | 49 +++++++++++++++++--- news_wizard/news.wiz | 1 + nfs_wizard/nfs.wiz | 84 ++++++++++++++++++++++++----------- nfs_wizard/scripts/NFSConf.pm | 11 ++--- postfix_wizard/postfix.wiz | 1 + proxy_wizard/proxy.wiz | 10 +++-- proxy_wizard/scripts/Squidconf.pm | 1 + samba_wizard/samba.wiz | 12 +++-- samba_wizard/scripts/Smbconf.pm | 53 +++++++++++++++++++--- samba_wizard/scripts/smb.conf.default | 10 ++--- time_wizard/scripts/NTPConf.pm | 8 ---- time_wizard/time.wiz | 74 +----------------------------- web_wizard/scripts/Webconf.pm | 32 +++++++++---- web_wizard/web.wiz | 14 +++--- 18 files changed, 308 insertions(+), 182 deletions(-) diff --git a/Makefile b/Makefile index a535cb2b..3b22ea19 100644 --- a/Makefile +++ b/Makefile @@ -51,8 +51,9 @@ clean_test: rm -rf test test: clean_test + @date mkdir test cp -r $(WIZ) test - cp Wizard.dtd Makefile drakwizard.pl drakwizard.spec test + cp Wizard.dtd Makefile drakwizard.pl drakwizard.spec test.pl test find test -regex ".*\.wiz$$\|.*\.pm$$\|.*\.sh$$" -exec \ perl -i -pe "s|__WIZ_HOME__|$(PWD)/test|g" \{\} \; diff --git a/dhcp_wizard/scripts/Dhcpconf.pm b/dhcp_wizard/scripts/Dhcpconf.pm index 40c1bc5e..4cb9a21a 100644 --- a/dhcp_wizard/scripts/Dhcpconf.pm +++ b/dhcp_wizard/scripts/Dhcpconf.pm @@ -85,7 +85,7 @@ sub do_it { #[ -f /etc/sysconfig/dhcpd ] && cp -f /etc/sysconfig/dhcpd /var/tmp/wiz_bck/orig/dhcpd my $file = "/etc/sysconfig/dhcpd"; - MDK::Common::cp_af($file, $file.".orig"); + -f $file and MDK::Common::cp_af($file, $file.".orig"); $file = "/etc/rc.d/init.d/dhcpd"; # now patching etc/rc.d/init.d/dhcpd @@ -134,6 +134,11 @@ mask = $wiz_ip_netmask, rng1 = $wiz_ip_range1, rng2 = $wiz_ip_range2, dname = $w standalone::explanations("$file: lease_file = $mdk{lease_file}, interfaces = $mdk{interfaces}"); Vareqval->commit($file, \%mdk); } + !$ENV{wiz_authoritative} and output($file, map { + s|^\s*not\s*authoritative.*|\#$&|i; + $_; + } cat_ ("/etc/dhcpd.conf")); + system("/etc/rc.d/init.d/dhcpd restart"); 10; } diff --git a/drakwizard.pl b/drakwizard.pl index bc5a7ce6..77ee0095 100755 --- a/drakwizard.pl +++ b/drakwizard.pl @@ -138,22 +138,7 @@ sub map_freetext { my @data = map { my $toto = $_->{variableName}; - if ($_->{main_order} eq 'combo') { - if($_->{fillScript}){ - @liste = (); - $valeur = `. $lib_script && $_->{fillScript}`; - while( $valeur =~ /(.+)\n/g){ - push @liste, $1; - $chooser_hash{$1} = $1; - } - } - if ($_->{fillfunc}){ - @liste = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->(); - } - else { - @liste = @{$_->{Option}}; - } - } + if ($_->{fillScript}) { $ENV{$variable{$_->{variableName}}} = `. $lib_script && $_->{fillScript}`; } @@ -167,8 +152,8 @@ sub map_freetext { help => $_->{help}} } elsif ($_->{main_order} eq 'bool') { - if ($_->{fillfunc}) { - my @checklist = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->(); + if ($_->{listfunc}) { + my @checklist = $::{$perl_module_name."::"}{"$_->{listfunc}"}->(); my $i = 21 - scalar @checklist; # workaround to get get the scrollbar if (!$::isSummary) { @@ -204,6 +189,20 @@ sub map_freetext { } } elsif ($_->{main_order} eq 'combo') { + if($_->{fillScript}){ + @liste = (); + $valeur = `. $lib_script && $_->{fillScript}`; + while( $valeur =~ /(.+)\n/g){ + push @liste, $1; + $chooser_hash{$1} = $1; + } + } + elsif ($_->{fillfunc}){ + @liste = $::{$perl_module_name."::"}{"$_->{fillfunc}"}->(); + } + else { + @liste = @{$_->{Option}}; + } { label => _($_->{helpText}), val => \$ENV{$variable{$_->{variableName}}}, list => [@liste], type => $_->{main_order}, @@ -251,14 +250,15 @@ sub get_parameter { $leaf->{helpText} = translate($leaf->{helpText}); if ($leaf->{fontName} eq "Monospaced") { chomp($leaf->{helpText}); - $leaf->{helpText} = $leaf->{helpText} ? "$leaf->{helpText}\n$leaf->{helpText}" : "$leaf->{helpText}\n"; + $leaf->{helpText} = $leaf->{helpText} ? + "$leaf->{helpText}\n$leaf->{helpText}" : "$leaf->{helpText}\n"; } $page->{info} = xml_text($leaf->{helpText} ? "$page->{info}\n$leaf->{helpText}" : "$page->{info}\n"); $page->{info} = c::from_utf8($page->{info}); - if ($leaf->{fillScript}) { - $page->{info} .= translate(`source $lib_script; $leaf->{fillScript}`); - } + + $page->{info} .= translate(`source $lib_script; $leaf->{fillScript}`) if + ($leaf->{fillScript}) }, Freetext => $common_freetext_chooser = sub { my $main_order = ($tag eq 'Chooser') ? 'combo' diff --git a/ftp_wizard/ftp.wiz b/ftp_wizard/ftp.wiz index 12e6b9f9..63ad0024 100644 --- a/ftp_wizard/ftp.wiz +++ b/ftp_wizard/ftp.wiz @@ -9,6 +9,7 @@ defaultImage="__WIZ_HOME__/ftp_wizard/images/FTP" perlModule="__WIZ_HOME__/ftp_wizard/scripts/ProFtpconf.pm" rpm="proftpd" + summaryFunc="do_it" > + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + ) { # we need 3 elements to consider section as known + if (m/^\s*/s...m/^\s*<\/drakwizard>/s ) { + if (m/^\s*/s ) { + return $1; + } + } + } + ""; +} + my $o = DrakconnectConf->new(); sub check { @@ -23,6 +39,23 @@ sub check { 0; } +sub print_anonymous() { + print ' +# + + User ftp + Group ftp + UserAlias anonymous ftp + MaxClients 10 + + DenyAll + + +# +'; +EOF +} + sub do_it { my $wiz_ftp_internal = $ENV{wiz_ftp_external} ? 1 : true $ENV{wiz_ftp_internal}; my $wiz_ftp_external = true $ENV{wiz_ftp_external}; @@ -41,23 +74,23 @@ sub do_it { my $file = "/etc/proftpd.conf"; open (NEW, "< $file"); my $exist = 0; - while () { + while () { # we need 3 elements to consider section as known if (m/^\s*/s...m/^\s*<\/Global>/s ) { if (m/^\s*/s...m/^\s*<\/Limit>/s ) { if (/^\s*(?!\#)\s*Order .*$/) { - $exist += 1; + $exist++; } if (/^\s*(?!\#)\s*Allow .*$/) { - $exist += 1; + $exist++; } if (/^\s*(?!\#)\s*Deny .*$/) { - $exist += 1; + $exist++; } } } } close (NEW); - if ($exist < 3) { + if ($exist < 3) { # Odd parameters are commented if exists to then add a known section substInFile { if (m/^\s*/s...m/^\s*<\/Global>/s ) { if (m/^\s*/s...m/^\s*<\/Limit>/s ) { @@ -69,16 +102,18 @@ sub do_it { } $file; open (NEW, ">> $file"); print NEW ' +# Order allow,deny Allow from '.$allow.' Deny from all -'; + +#'; close NEW; } - else { + else { # the known section (3 parameters ) is replaced with our needs substInFile { if (m/^\s*/s...m/^\s*<\/Global>/s ) { if (m/^\s*/s...m/^\s*<\/Limit>/s ) { diff --git a/news_wizard/news.wiz b/news_wizard/news.wiz index 2306333c..516ad650 100644 --- a/news_wizard/news.wiz +++ b/news_wizard/news.wiz @@ -9,6 +9,7 @@ defaultImage="__WIZ_HOME__/news_wizard/images/news" perlModule="__WIZ_HOME__/news_wizard/scripts/Newsconf.pm" rpm="leafnode" + summaryFunc="do_it" > @@ -168,7 +169,6 @@ - @@ -434,6 +435,7 @@ jumpPage="doit" executionLevel="NORMAL" nextFinish="false" + is="wiz_squid_menupeer=2" canBack="true" canCancel="true" > diff --git a/proxy_wizard/scripts/Squidconf.pm b/proxy_wizard/scripts/Squidconf.pm index b586b711..3c343b8f 100644 --- a/proxy_wizard/scripts/Squidconf.pm +++ b/proxy_wizard/scripts/Squidconf.pm @@ -49,6 +49,7 @@ sub do_it_squid { standalone::explanations("$file: cache_dir = $ENV{wiz_squid_defdir} $ENV{wiz_squid_disk} mynetw = $ENV{wiz_squid_mynetw} cache_mem = $ENV{wiz_squid_mem} http_port = $ENV{wiz_squid_port} level = $ENV{wiz_squid_level}"); + print "$ENV{wiz_squid_level}\n"; if ($ENV{wiz_squid_level} == 1) { substInFile { s|^\s*\#?\s*(http_access\s*)deny(\s*all.*)|\#$&\n$1allow$2|; diff --git a/samba_wizard/samba.wiz b/samba_wizard/samba.wiz index bd183fcd..00c075c2 100644 --- a/samba_wizard/samba.wiz +++ b/samba_wizard/samba.wiz @@ -320,24 +320,28 @@ helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-samba.html" name="ask_printers" jumpPage="ask_workgroup" + func="check_printers" is="doPrinterSharing" executionLevel="NORMAL" nextFinish="false" canBack="true" canCancel="true" > + + - - + {conf}->{public}{"write list"}{value}; +} + +sub get_read { + $old->{conf}->{public}{"read list"}{value}; +} + +sub check_banner { + !$ENV{wiz_banner} and return 1; + 10; +} + sub get_workgroup { $old->{conf}->{global}{workgroup}{value}; } @@ -140,7 +175,9 @@ sub get_banner { } sub ask_dir { - $ENV{wiz_do_file_sharing}; + return 2 if $ENV{wiz_do_file_sharing}; + return 1 if $ENV{wiz_do_printer_sharing}; + 0; } sub get_dir { @@ -152,6 +189,8 @@ sub do_it { my $conf = read_conf("__WIZ_HOME__/samba_wizard/scripts/smb.conf.default"); $conf->chg_var("global", "workgroup", $ENV{wiz_workgroup}); $conf->chg_var("global", "server string", $ENV{wiz_banner}); + $conf->chg_var("public", "write list", $ENV{wiz_write_list}) if $ENV{wiz_do_file_sharing}; + $conf->chg_var("public", "read list", $ENV{wiz_read_list}) if $ENV{wiz_do_file_sharing}; my $ip = $o->get_from_known_dev("IP"); $conf->file_sharing() if $ENV{wiz_do_file_sharing}; $conf->printer_sharing() if $ENV{wiz_do_printer_sharing}; diff --git a/samba_wizard/scripts/smb.conf.default b/samba_wizard/scripts/smb.conf.default index 8781db7e..a6012972 100644 --- a/samba_wizard/scripts/smb.conf.default +++ b/samba_wizard/scripts/smb.conf.default @@ -305,14 +305,14 @@ ; read only = no ; public = yes -# A publicly accessible directory, but read only, except for people in -# the "staff" group +# A publicly accessible directory + ;[public] ; comment = Public Stuff ; path = /home/samba/public -; public = yes -; writable = no -; write list = @staff +; write list = @wheel +; read list = nobody, @users +; guest ok = no # Other examples. # diff --git a/time_wizard/scripts/NTPConf.pm b/time_wizard/scripts/NTPConf.pm index 77a5576c..fb37b8a6 100644 --- a/time_wizard/scripts/NTPConf.pm +++ b/time_wizard/scripts/NTPConf.pm @@ -25,14 +25,6 @@ use MDK::Common; use strict; use standalone; -sub chooser { - if ($ENV{chooser1} eq "local") { - do_it(); - return 1; - } - 2; -} - sub chooser4 { if ($ENV{chooser4} eq "save_quit") { do_it(); diff --git a/time_wizard/time.wiz b/time_wizard/time.wiz index 889e0b29..65a3e05a 100644 --- a/time_wizard/time.wiz +++ b/time_wizard/time.wiz @@ -9,6 +9,7 @@ defaultImage="__WIZ_HOME__/time_wizard/images/Time" perlModule="__WIZ_HOME__/time_wizard/scripts/NTPConf.pm" rpm="ntp" + summaryFunc="do_it" > @@ -76,72 +76,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -213,6 +216,8 @@ @@ -270,7 +276,6 @@ - -- cgit v1.2.1