summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorDamien Chaumette <dchaumette@mandriva.com>2004-02-06 12:11:31 +0000
committerDamien Chaumette <dchaumette@mandriva.com>2004-02-06 12:11:31 +0000
commitb4d9d2ae2dbe8df394730a4cfb4d29c647e18ef5 (patch)
tree2d66e994d5afaf1f09530b8e9f2e5e35b265f75b /perl-install
parent50853553d9069079271fad9b5d875fd8379d94c6 (diff)
downloaddrakx-b4d9d2ae2dbe8df394730a4cfb4d29c647e18ef5.tar
drakx-b4d9d2ae2dbe8df394730a4cfb4d29c647e18ef5.tar.gz
drakx-b4d9d2ae2dbe8df394730a4cfb4d29c647e18ef5.tar.bz2
drakx-b4d9d2ae2dbe8df394730a4cfb4d29c647e18ef5.tar.xz
drakx-b4d9d2ae2dbe8df394730a4cfb4d29c647e18ef5.zip
- add sub check_field
- check IPs - delete BOOTPROTO when not needed
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/standalone/drakconnect12
1 files changed, 10 insertions, 2 deletions
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index e95631dfd..ace8d710b 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -321,7 +321,7 @@ sub build_notebook {
),
),
);
- $gui->{intf}{BOOTPROTO} and $gui->{intf}{BOOTPROTO}->set_popdown_strings(N_("static"), N_("dhcp"));
+ $interface =~ /eth/ ? $gui->{intf}{BOOTPROTO}->set_popdown_strings(N_("static"), N_("dhcp")) : delete $gui->{intf}{BOOTPROTO};
$interface !~ /eth/ and $_->set_sensitive(0) foreach $gui->{intf}{IPADDR}, $gui->{intf}{NETMASK};
!$intf->{IPADDR} and ($intf->{IPADDR}, $gui->{active}, $intf->{NETMASK}) = get_intf_ip($interface);
$gui->{netc}{$_}->set_text($netc->{$_}) foreach keys %{$gui->{netc}};
@@ -491,7 +491,7 @@ sub save {
my ($netc, $netcnx, $intf, $gui, $apply_button) = @_;
foreach (keys %$intf) {
- save_notebook($netc, $intf->{$_}, $gui->{$_});
+ save_notebook($netc, $intf->{$_}, $gui->{$_}) or $in->ask_warn(N("Error"), N("IP address should be in format 1.2.3.4")) and return;
$intf->{$_}{save} and $intf->{$_}{save}->();
}
apply($netc, $netcnx, $intf, $apply_button);
@@ -506,6 +506,14 @@ sub save_notebook {
$intf->{$_} = bool2yesno($gui->{intf_bool}{$_}->get_active) foreach keys %{$gui->{intf_bool}};
$gui->{intf_bool}{MII_NOT_SUPPORTED} and $intf->{MII_NOT_SUPPORTED} = bool2yesno(!$gui->{intf_bool}{MII_NOT_SUPPORTED}->get_active);
$gui->{intf_bool}{HWADDR} and (bool2yesno($gui->{intf_bool}{HWADDR}->get_active) eq 'yes' ? ($intf->{HWADDR} = 'yes') : delete $intf->{HWADDR});
+
+ $intf->{BOOTPROTO} eq 'static' and (check_field($intf, 'IPADDR', 'NETMASK') or return 0);
+ 1;
+}
+
+sub check_field {
+ my ($field, @ip) = @_;
+ (map { if_(!is_ip($field->{$_}), 1) } @ip) ? 0 : 1;
}
sub add_intf() {