diff options
author | Florent Villard <warly@mandriva.com> | 2003-03-05 17:38:49 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2003-03-05 17:38:49 +0000 |
commit | 23404e9c708a1f5960a1ae7ec54234117c6b39d9 (patch) | |
tree | 2f637b200141ea5b1f0272f5f3562a579d0ec7a1 | |
parent | f8de1ab367e0c87e84920dd88a04f66b613ce271 (diff) | |
download | drakwizard-23404e9c708a1f5960a1ae7ec54234117c6b39d9.tar drakwizard-23404e9c708a1f5960a1ae7ec54234117c6b39d9.tar.gz drakwizard-23404e9c708a1f5960a1ae7ec54234117c6b39d9.tar.bz2 drakwizard-23404e9c708a1f5960a1ae7ec54234117c6b39d9.tar.xz drakwizard-23404e9c708a1f5960a1ae7ec54234117c6b39d9.zip |
various fixes in server wizard
deactivate firewall wizard
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | drakwizard.spec | 6 | ||||
-rw-r--r-- | server_wizard/scripts/Serverconf.pm | 71 | ||||
-rwxr-xr-x | server_wizard/scripts/check_config.sh | 2 | ||||
-rwxr-xr-x | server_wizard/scripts/liste_device.sh | 2 | ||||
-rw-r--r-- | server_wizard/server.wiz | 70 |
6 files changed, 101 insertions, 53 deletions
@@ -6,10 +6,9 @@ TAR = $(NAME).tar.bz2 WIZ_HOME=/usr/share/wizards WIZ = common\ - server_wizard\ + server_wizard\ dhcp_wizard\ dns_wizard\ - firewall_wizard\ postfix_wizard\ samba_wizard\ time_wizard\ diff --git a/drakwizard.spec b/drakwizard.spec index e059347b..153cbf08 100644 --- a/drakwizard.spec +++ b/drakwizard.spec @@ -1,5 +1,5 @@ %define name drakwizard -%define version 1.4 +%define version 1.5 %define release 1mdk Name: %{name} @@ -51,6 +51,10 @@ rm -rf $RPM_BUILD_DIR/$RPM_PACKAGE_NAME %_datadir/wizards* %changelog +* Wed Mar 05 2003 Warly <warly@mandrakesoft.com> 1.5-1mdk +- remove firewall wizard +- try to fix server wizard (unused anyway) + * Mon Mar 03 2003 Warly <warly@mandrakesoft.com> 1.4-1mdk - gc fixes UTF8 problem diff --git a/server_wizard/scripts/Serverconf.pm b/server_wizard/scripts/Serverconf.pm index 4f70e74a..23a0eb91 100644 --- a/server_wizard/scripts/Serverconf.pm +++ b/server_wizard/scripts/Serverconf.pm @@ -1,10 +1,51 @@ #!/usr/bin/perl package Serverconf; -require "__WIZ_HOME__/common/scripts/Vareqval.pm"; +require "/usr/share/wizards/common/scripts/Vareqval.pm"; +require "/usr/share/wizards/common/scripts/IFCFG.pm"; use MDK::Common; use strict; +my $o = IFCFG->new(); + +sub get_hostname { + my $host = $o->network_get("HOSTNAME"); + return $host if $host; + "host.domain" +} + +sub check_domain { + $ENV{wiz_host_name} =~ /\S+\.\S+/ and return 10; + 1 +} + +sub check_network { + print "$ENV{wiz_ip_net}\n"; + foreach (split '\.', $ENV{wiz_ip_net}) { + $_ >= 0 && $_ < 256 or return 1 + } + return 10 +} + +sub get_net { + $o->itf_get('NET_ADDR') or "192.168.1.0"; +} + +sub compute_server_ip { + $o->itf_get('ADDR') or "192.168.1.1" +} + +sub set_ip { + +} + +sub check_server_ip { + my @net = split '\.', $ENV{wiz_ip_net}; + my @ip = split '\.', $ENV{wiz_ip_server}; + mapn { $_[0] == $_[1] || $_[0] == 0 or return 0 } \@net, \@ip; + return 10 +} + sub do_it_last { my $file = "/etc/sysconfig/mdk_serv"; MDK::Common::cp_af($file, $file.".orig"); @@ -17,6 +58,18 @@ wiz_host_name=$ENV{wiz_host_name} wiz_domain_name=$ENV{wiz_domain_name}"; } +sub get_gateway_dev { + $o->network_get('GATEWAYDEV') or "eth0" +} + +sub get_device { + "eth0" +} + +sub get_gateway { + $o->network_get('GATEWAY') +} + sub do_it { my $old_ip; my $date = `date`; @@ -39,9 +92,9 @@ sub do_it { $file = "/etc/sysconfig/network-scripts/ifcfg-$ENV{wiz_device}" if defined $ENV{wiz_device} or die "wiz_device not in env"; if (-f $file) { - MDK::Common::cp_af($file, $file . ".orig"); + MDK::Common::cp_af($file, "mdk_$file.orig"); %mdk = Vareqval->get($file); - $old_ip = $mdk{IPADDR} if defined $mdk{IPADDR} or die "IPADDR not found in $file"; + $old_ip = $mdk{IPADDR} || $o->network_get('IPADDR') } else { system("touch $file"); @@ -72,14 +125,6 @@ sub do_it { # chg_val sequence ended Vareqval->commit($file, \%mdk); - $file = "/etc/HOSTNAME"; - MDK::Common::cp_af($file, $file . ".orig"); - open(NEW, "> $file") or die "can not open $file"; - print NEW "$hostname"; - close(NEW) or die "can not close $file"; - system("hostname $hostname"); - my ($hostalias) = ($hostname =~ /^([^.]*)\..*$/); - $file = "/etc/hosts"; MDK::Common::cp_af($file, $file . ".orig"); if (defined $old_ip && $old_ip ne $new_ip) { @@ -91,7 +136,7 @@ sub do_it { if (/^\s*(?!\#)*\s*$old_ip.*$/) { print NEW "# removed by mdk_serv script on $date #$_ -$new_ip\t$hostname\t$hostalias\n"; +$new_ip\t$hostname\n"; next; } print NEW $_; @@ -102,7 +147,7 @@ $new_ip\t$hostname\t$hostalias\n"; } else { open(NEW, ">> $file"); - print NEW "$new_ip\t$hostname\t$hostalias\n"; + print NEW "$new_ip\t$hostname\n"; close NEW; } do_it_last(); diff --git a/server_wizard/scripts/check_config.sh b/server_wizard/scripts/check_config.sh index f44bd42c..512fd7da 100755 --- a/server_wizard/scripts/check_config.sh +++ b/server_wizard/scripts/check_config.sh @@ -28,7 +28,7 @@ # checking if the provided domain value is correct : # strip the @, need at least a dot -echo_debug "$(date) begin $0" +echo_debug "$(/bin/date) begin $0" fic=/etc/sysconfig/mdk_serv if [ ! -f "$fic" ] ;then diff --git a/server_wizard/scripts/liste_device.sh b/server_wizard/scripts/liste_device.sh index 0f830728..0dbdba9b 100755 --- a/server_wizard/scripts/liste_device.sh +++ b/server_wizard/scripts/liste_device.sh @@ -31,7 +31,7 @@ liste="" -liste=$liste"`ifconfig -a | awk ' /^eth/ { print $1"\n"$1, $4,":",$5 } '`\n" +liste=$liste"`/sbin/ifconfig -a | /bin/awk ' /^eth/ { print $1"\n"$1, $4,":",$5 } '`\n" # display only configured device #for i in 0 1 2 3 ;do diff --git a/server_wizard/server.wiz b/server_wizard/server.wiz index 9a63fd80..301d31fd 100644 --- a/server_wizard/server.wiz +++ b/server_wizard/server.wiz @@ -14,7 +14,6 @@ name="hostname" comment="The host name of the server" shellVariable="wiz_host_name" - defaultValue="host.domain.net" valueIsTranslated="false" > </Variable> @@ -32,7 +31,6 @@ name="network_address" comment="The network address" shellVariable="wiz_ip_net" - defaultValue="192.168.0.0" valueIsTranslated="false" > </Variable> @@ -41,7 +39,6 @@ name="server_address" comment="The server IP address" shellVariable="wiz_ip_server" - defaultValue="192.168.0.1" valueIsTranslated="false" > </Variable> @@ -50,7 +47,6 @@ name="net_device" comment="The device used to the network connection" shellVariable="wiz_device" - defaultValue="eth0" valueIsTranslated="false" > </Variable> @@ -177,7 +173,7 @@ <Freetext name="freetext" variableName="hostname" - fillScript="get_var wiz_host_name" + fillfunc="get_hostname" editable="true" > </Freetext> @@ -186,7 +182,7 @@ <Page name="ask_hostname" helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-basics.html" - jumpScript="__WIZ_HOME__/server_wizard/scripts/check_domain.sh" + func="check_domain" executionLevel="NORMAL" nextFinish="false" canBack="true" @@ -221,13 +217,12 @@ name="hostnameInput" comment="Host name input field" variableName="hostname" - fillScript="get_var wiz_host_name $wiz_host_name" + fillfunc="get_hostname" helpText="Host Name:" editable="true" > </Freetext> - <Info helpText="Host names must be in the form \qhost.domain.domaintype\q; if your server will be an Internet server, the domain name should be the name registered with your provider. If you will only have intranet any valid name is OK, like \qcompany.net\q." > @@ -235,26 +230,10 @@ </Page> <Page - name="error_in_hostname" - comment="Error message for an incorrect hostname" - helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-basics.html" - jumpPage="load_hostname_value" - nextButtonText="Fix it" - executionLevel="NORMAL" - nextFinish="false" - canBack="true" - canCancel="true" - > - - <Info - helpText="The host name is not correct" - > - </Info> - </Page> - <Page name="choose_net_device" helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-basics.html" - jumpScript="__WIZ_HOME__/server_wizard/scripts/set_ip.sh" + func="set_ip" + jumpPage="load_net_address" executionLevel="NORMAL" nextFinish="false" canBack="true" @@ -272,20 +251,18 @@ > </Info> - <Chooser name="deviceChooser" variableName="net_device" + defaultOptionScript="__WIZ_HOME__/firewall_wizard/scripts/compute_ext_device.sh" fillScript="__WIZ_HOME__/server_wizard/scripts/liste_device.sh" helpText="Device:" helpFontName="Default" helpFontStyle="plain" helpFontSize="12" - editable="false" > </Chooser> - <Info helpText="Devices are presented with the Linux name and, if known, with the card description." > @@ -308,7 +285,7 @@ <Freetext name="net_deviceField" variableName="net_device" - fillScript="get_var wiz_device" + fillfunc="get_device" helpText="net device" editable="false" > @@ -336,7 +313,7 @@ <Freetext name="freetext1" variableName="network_address" - fillScript="get_val wiz_ip_net" + fillfunc="get_net" editable="true" > </Freetext> @@ -345,7 +322,7 @@ <Page name="ask_network_address" helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-basics.html" - jumpScript="__WIZ_HOME__/server_wizard/scripts/check_network.sh" + func="check_network" executionLevel="NORMAL" nextFinish="false" canBack="true" @@ -379,7 +356,7 @@ <Freetext name="freetext2" variableName="network_address" - fillScript="__WIZ_HOME__/server_wizard/scripts/compute_ipnet.sh" + fillfunc="get_net" helpText="IP net address:" editable="true" > @@ -426,7 +403,7 @@ <Freetext name="freetext3" variableName="server_address" - fillScript="__WIZ_HOME__/server_wizard/scripts/compute_server_ip.sh" + fillfunc="compute_server_ip" editable="false" > </Freetext> @@ -471,7 +448,7 @@ <Page name="ask_server_address" helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-basics.html" - jumpScript="__WIZ_HOME__/server_wizard/scripts/check_server_ip.sh" + func="check_server_ip" executionLevel="NORMAL" nextFinish="false" canBack="true" @@ -505,6 +482,7 @@ <Freetext name="serverAddressInput" variableName="server_address" + fillfunc="compute_server_ip" helpText="Server IP address:" editable="true" > @@ -570,6 +548,7 @@ name="get_gatewaydev" variableName="wiz_extn_device" helpText="Gateway device:" + fillfunc="get_gateway_dev" editable="true" > </Freetext> @@ -577,6 +556,7 @@ <Freetext name="get_ipgateway" variableName="wiz_extn_gateway" + fillfunc="get_gateway" helpText="Gateway IP:" editable="true" > @@ -631,6 +611,7 @@ <Freetext name="serverIPConfirm" variableName="server_address" + fillfunc="compute_server_ip" helpText="Server Address:" editable="false" > @@ -722,4 +703,23 @@ > </Info> </Page> + + <Page + name="error_in_hostname" + comment="Error message for an incorrect hostname" + helpURL="file:/usr/share/doc/mandrake/${LANG}/ref.html/wiz-basics.html" + jumpPage="load_hostname_value" + nextButtonText="Fix it" + executionLevel="NORMAL" + nextFinish="false" + canBack="true" + canCancel="true" + > + + <Info + helpText="The host name is not correct" + > + </Info> + </Page> + </Wizard> |