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 /server_wizard/scripts | |
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
Diffstat (limited to 'server_wizard/scripts')
-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 |
3 files changed, 60 insertions, 15 deletions
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 |