summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-05-12 12:20:52 +0000
committerOlivier Blin <oblin@mandriva.com>2008-05-12 12:20:52 +0000
commitbc62bd515fce6f9faca5955d1cd4fb41664133f1 (patch)
tree0ed88763f2f55b5d844bae062907f7aed17144ff /lib
parentf38d797e29dff82f9c1a6d469b48b8440d3775a7 (diff)
downloaddrakx-net-bc62bd515fce6f9faca5955d1cd4fb41664133f1.tar
drakx-net-bc62bd515fce6f9faca5955d1cd4fb41664133f1.tar.gz
drakx-net-bc62bd515fce6f9faca5955d1cd4fb41664133f1.tar.bz2
drakx-net-bc62bd515fce6f9faca5955d1cd4fb41664133f1.tar.xz
drakx-net-bc62bd515fce6f9faca5955d1cd4fb41664133f1.zip
allow to skip protocol and address configuration (defaulting to dhcp) if AUTOMATIC_ADDRESS is true in /etc/sysconfig/drakx-net
Diffstat (limited to 'lib')
-rw-r--r--lib/network/connection/ethernet.pm6
-rw-r--r--lib/network/connection_manager.pm4
-rw-r--r--lib/network/netconnect.pm2
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm
index 81592e1..bdc371e 100644
--- a/lib/network/connection/ethernet.pm
+++ b/lib/network/connection/ethernet.pm
@@ -63,8 +63,10 @@ sub check_device {
}
sub get_protocols() {
- {
- static => N("Manual configuration"),
+ my $system_file = '/etc/sysconfig/drakx-net';
+ my %global_settings = getVarsFromSh($system_file);
+ +{
+ if_(!text2bool($global_settings{AUTOMATIC_ADDRESS}), static => N("Manual configuration")),
dhcp => N("Automatic IP (BOOTP/DHCP)"),
};
}
diff --git a/lib/network/connection_manager.pm b/lib/network/connection_manager.pm
index 5cf9176..09949d9 100644
--- a/lib/network/connection_manager.pm
+++ b/lib/network/connection_manager.pm
@@ -121,6 +121,8 @@ sub configure_connection {
}
$cmanager->load_settings;
+ my $system_file = '/etc/sysconfig/drakx-net';
+ my %global_settings = getVarsFromSh($system_file);
my $error;
do {
@@ -143,7 +145,7 @@ sub configure_connection {
{ label => $cmanager->{connection}->get_access_settings_label, title => 1, advanced => 1 },
@{$cmanager->{connection}->get_access_settings}
) : (),
- $cmanager->{connection}->can('get_address_settings') ? (
+ $cmanager->{connection}->can('get_address_settings') && !text2bool($global_settings{AUTOMATIC_ADDRESS}) ? (
{ label => $cmanager->{connection}->get_address_settings_label, title => 1, advanced => 1 },
@{$cmanager->{connection}->get_address_settings('show_all')}
) : (),
diff --git a/lib/network/netconnect.pm b/lib/network/netconnect.pm
index 3e90865..eb1b2c6 100644
--- a/lib/network/netconnect.pm
+++ b/lib/network/netconnect.pm
@@ -100,7 +100,7 @@ sub real_main {
"select_protocol" => sub { $connection->can('get_protocols') },
#- peer settings may depend on provider and protocol (VPI/VCI for xDSL)
"configure_access" => sub { $connection->can('get_access_settings') },
- "configure_address" => sub { $connection->can('get_address_settings') || $connection->can('get_hostname_settings') },
+ "configure_address" => sub { ($connection->can('get_address_settings') || $connection->can('get_hostname_settings')) && !text2bool($global_settings{AUTOMATIC_ADDRESS}) },
"configure_control" => sub { $connection->can('get_control_settings') },
"apply_connection" => sub { 1 },
);