summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-06-03 07:14:48 +0000
committerOlivier Blin <oblin@mandriva.org>2005-06-03 07:14:48 +0000
commit8fc41a1333f01496878ca0561f3ca1ad186b6d64 (patch)
tree2dd030c580d5b8e954bce95508ac7ecacc6127b9 /perl-install/standalone
parent671adafbfbb78f044970bc4af895ed43dff99757 (diff)
downloaddrakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.tar
drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.tar.gz
drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.tar.bz2
drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.tar.xz
drakx-8fc41a1333f01496878ca0561f3ca1ad186b6d64.zip
- merge network settings in a $net hash (it modifies $o fields too):
o $netc becomes $net->{network} and $net->{resolv} o $intf becomes $net->{ifcfg} - move zeroconf config stuff in write_zeroconf - read_tmdns_conf -> read_zeroconf - read_all_conf -> read_net_conf - configureNetwork2 -> configure_network - configure_network: write ifcfg files for ppp interfaces too - don't install wireless-tools in configure_network, this package is in basesystem - most functions don't need the file path as an argument in network::network - drop network::tools::remove_initscript - don't export too much from network::network - don't export from network::tools - remove adsl_unsupported_eci step in drakconnect - drop passwd2 field in network::adsl - drop $net->{isdn_internal} - network::netconnect : main -> safe_main - use network::netconnect::real_main during install - don't read network config in network::netconnect::real_main - install_steps::upNetwork : resolv.conf is already symlinked by network::network::configure_network when appropriate - try to fix install_any::generate_automatic_stage1_params to use a real interface configuration - put authentication stuff in $net->{auth} - drop network::ethernet::write_ether_conf - drop network::adsl::get_wizard - use 'static' instead of 'manual' as ADSL method - drop first_modem and its workarounds in network::modem - drop deprecated "multiple_internet_cnx" step in drakconnect - don't save /etc/sysconfig/drakconnect anymore - drop MDK::Common::Globals stuff - drop getIP in net_applet (Pixel) - drop $netc->{DHCP} - configure_network(): write resolv.conf even if a dhcp interface is configured
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/drakauth9
-rwxr-xr-xperl-install/standalone/drakautoinst4
-rwxr-xr-xperl-install/standalone/drakconnect149
-rwxr-xr-xperl-install/standalone/drakpxe18
-rwxr-xr-xperl-install/standalone/finish-install12
-rw-r--r--perl-install/standalone/net_applet29
-rwxr-xr-xperl-install/standalone/net_monitor21
7 files changed, 109 insertions, 133 deletions
diff --git a/perl-install/standalone/drakauth b/perl-install/standalone/drakauth
index d29f250ca..db7418d51 100755
--- a/perl-install/standalone/drakauth
+++ b/perl-install/standalone/drakauth
@@ -9,7 +9,8 @@ use interactive;
use authentication;
use network::network;
-read_all_conf('', my $netc = {}, my $_intf = {});
+my $net = {};
+network::network::read_net_conf($net);
my $in = 'interactive'->vnew('su');
@@ -25,11 +26,11 @@ $in->ask_from(N("Authentication"), authentication::kind2description(@kinds),
{ label => N("Authentication"), val => \$kind, type => 'list' , list => \@kinds, format => \&authentication::kind2name },
]) or $in->exit;
-authentication::ask_parameters($in, $netc, $authentication, $kind) or goto main;
+authentication::ask_parameters($in, $net, $authentication, $kind) or goto main;
eval {
- authentication::set($in, $netc, $authentication);
- network::network::write_conf($netc);
+ authentication::set($in, $net, $authentication);
+ network::network::write_conf($net);
};
if (my $err = $@) {
$in->ask_warn(N("Error"), formatError($err));
diff --git a/perl-install/standalone/drakautoinst b/perl-install/standalone/drakautoinst
index 2933eb347..6dbfb3a36 100755
--- a/perl-install/standalone/drakautoinst
+++ b/perl-install/standalone/drakautoinst
@@ -126,9 +126,7 @@ if (!$::isEmbedded && $in->isa('interactive::gtk')) {
manualFstab => 'partition',
useSupermount => '',
partitioning => 'partition',
- intf => 'network',
- netc => 'network',
- netcnx => 'network',
+ net => 'network',
superuser => 'user',
users => 'user',
authentication => '',
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect
index 1f22003ec..81a15d7dc 100755
--- a/perl-install/standalone/drakconnect
+++ b/perl-install/standalone/drakconnect
@@ -39,7 +39,6 @@ use c;
use modules;
use network::isdn;
use network::adsl;
-use network::tools;
use network::test;
use POSIX ":sys_wait_h";
@@ -50,15 +49,15 @@ if ($in->isa('interactive::gtk')) {
ugtk2->import(qw(:create :dialogs :helpers :wrappers));
}
-my ($netcnx, $netc, $intf) = ({}, {}, {});
-network::netconnect::read_net_conf($netcnx, $netc, $intf);
+my $net = {};
+network::network::read_net_conf($net);
my $modules_conf = modules::any_conf->read;
$::Wizard_title = N("Network & Internet Configuration");
$::Wizard_pix_up = "drakconnect.png";
local $_ = join '', @ARGV;
-/--skip-wizard/ and manage($netc, $intf);
+/--skip-wizard/ and manage();
/--add/ and add_intf();
/--del/ and del_intf();
/--old/ and goto old;
@@ -66,7 +65,7 @@ if (/--install/) {
$::isInstall = 1;
add_intf();
}
-/--internet/ and configure_net($netcnx, $netc, $intf);
+/--internet/ and configure_net();
# default is to run wizard
add_intf();
@@ -89,17 +88,17 @@ my $button_apply;
my $hostname = chomp_(`hostname`);
-my $int_label = Gtk2::Label->new($netcnx->{type} eq 'lan' ? N("Gateway:") : N("Interface:"));
-my $int_name = Gtk2::Label->new($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
+my $int_label = Gtk2::Label->new($net->{type} eq 'lan' ? N("Gateway:") : N("Interface:"));
+my $int_name = Gtk2::Label->new($net->{type} eq 'lan' ? $net->{network}{GATEWAY} : $net->{net_interface});
my $isconnected = -1;
my $int_connect = Gtk2::Button->new(N("Wait please"));
$int_connect->set_sensitive(0);
$int_connect->signal_connect(clicked => sub {
if (!$isconnected) {
- connect_backend($netc);
+ network::tools::connect_backend($net);
} else {
- disconnect_backend($netc);
+ network::tools::disconnect_backend($net);
}
});
@@ -132,7 +131,7 @@ $window1->{window}->add(
clicked => sub {
local ($::isWizard, $::Wizard_finished) = (1, 1);
eval { # For wizcancel
- network::netconnect::main($netcnx, $in, $modules_conf, $netc, undef, $intf);
+ network::netconnect::safe_main($net, $in, $modules_conf);
$button_apply->set_sensitive(1);
update();
};
@@ -165,7 +164,7 @@ $window1->{window}->add(
Gtk2::Label->new(N("Please Wait... Applying the configuration")));
$dialog->show_all;
gtkflush();
- apply($netc, $intf);
+ apply();
$dialog->destroy;
}
update();
@@ -182,9 +181,7 @@ gtkflush();
$window1->main;
ugtk2->exit(0);
-sub manage {
- my ($netc, $intf) = @_;
-
+sub manage() {
my $p = {};
my ($interface_menu, $selected, $apply_button);
my $window = ugtk2->new('Manage Connection');
@@ -203,10 +200,10 @@ sub manage {
my $dev = detect_devices::is_lan_interface($_) ? $names{$_} : $_;
$p->{$dev} = {
name => $_ ,
- intf => $intf->{$_}
+ intf => $net->{ifcfg}{$_}
};
}
- while (my ($device, $interface) = each %$intf) {
+ while (my ($device, $interface) = each %{$net->{ifcfg}}) {
exists $names{$device} and next;
my $type = network::tools::get_interface_type($interface);
$p->{"$type ($device)"} = {
@@ -231,7 +228,7 @@ sub manage {
cancel_clicked => sub { $window->destroy; Gtk2->main_quit },
ok_clicked => sub {
if ($apply_button->get_property('sensitive')) {
- save($netc, $p, $apply_button);
+ save($p, $apply_button);
}
$window->destroy;
Gtk2->main_quit;
@@ -239,18 +236,18 @@ sub manage {
},
undef, undef, '',
[ N("Help"), sub { exec("drakhelp --id internet-connection") unless fork() } ],
- [ N("Apply"), sub { save($netc, $p, $apply_button) }, 0, 1 ],
+ [ N("Apply"), sub { save($p, $apply_button) }, 0, 1 ],
),
),
);
$apply_button = $oc->{buttons}{N("Apply")};
each_index {
- my ($name, $interface, $protocol) = ($_, $p->{$_}{name}, $p->{$_}{protocol});
+ my ($name, $interface) = ($_, $p->{$_}{name});
$p->{$name}{gui}{index} = $::i;
$p->{$name}{intf} ||= { DEVICE => $interface };
- build_tree($netc, $p->{$name}{intf}, $name, $interface, $protocol);
- build_notebook($netc, $p->{$name}{intf}, $p->{$name}{gui}, $apply_button, $name, $interface);
+ build_tree($p->{$name}{intf}, $name);
+ build_notebook($p->{$name}{intf}, $p->{$name}{gui}, $apply_button, $name, $interface);
$notebook->append_page(gtkpack(Gtk2::VBox->new(0,0), $p->{$name}{gui}{notebook}));
} (sort keys %$p);
@@ -264,20 +261,19 @@ sub manage {
}
sub build_tree {
- my ($netc, $intf, $interface, $interface_name, $protocol) = @_;
+ my ($intf, $interface) = @_;
if ($interface eq 'adsl') {
$intf->{pages} = { 'TCP/IP' => 1, 'DHCP' => 1, 'Account' => 1, 'Options' => 1, 'Information' => 1 };
- network::adsl::adsl_probe_info($intf, $netc, $protocol, $interface_name);
+ network::adsl::adsl_probe_info($net);
$intf->{save} = sub {
- $netc->{internet_cnx_choice} = 'adsl';
- $netc->{at_boot} = $intf->{ONBOOT} eq 'yes' ? 1 : 0;
- network::adsl::adsl_conf_backend($in, $modules_conf, $netcnx, $netc, $intf, $interface_name, $protocol);
+ $net->{type} = 'adsl';
+ network::adsl::adsl_conf_backend($in, $modules_conf, $net);
};
}
elsif ($interface eq 'modem') {
$intf->{pages} = { 'TCP/IP' => 1, 'Account' => 1, 'Modem' => 1, 'Options' => 1 };
- put_in_hash($intf, network::modem::ppp_read_conf({}, $netc));
+ put_in_hash($intf, network::modem::ppp_read_conf());
$intf->{save} = sub { network::modem::ppp_configure($in, $intf) };
}
elsif ($interface eq 'isdn') {
@@ -292,7 +288,7 @@ sub build_tree {
}
sub build_notebook {
- my ($netc, $intf, $gui, $apply_button, $interface, $interface_name) = @_;
+ my ($intf, $gui, $apply_button, $interface, $interface_name) = @_;
my $apply = sub { $apply_button->set_sensitive(1) };
my $is_ethernet = detect_devices::is_lan_interface($interface);
@@ -340,14 +336,14 @@ sub build_notebook {
gtkpack_(Gtk2::VBox->new,
1, gtkadd(gtkcreate_frame(N("DNS servers")),
gtkpack(Gtk2::VBox->new(0,0),
- Gtk2::Label->new($intf->{dns1} || $netc->{dnsServer}),
- if_($intf->{dns2} || $netc->{dnsServer2},
- Gtk2::Label->new($intf->{dns2} || $netc->{dnsServer2})),
- if_($intf->{dns3} || $netc->{dnsServer3},
- Gtk2::Label->new($intf->{dns3} || $netc->{dnsServer3}))),
+ Gtk2::Label->new($intf->{dns1} || $net->{resolv}{dnsServer}),
+ if_($intf->{dns2} || $net->{resolv}{dnsServer2},
+ Gtk2::Label->new($intf->{dns2} || $net->{resolv}{dnsServer2})),
+ if_($intf->{dns3} || $net->{resolv}{dnsServer3},
+ Gtk2::Label->new($intf->{dns3} || $net->{resolv}{dnsServer3}))),
),
1, gtkadd(gtkcreate_frame(N("Search Domain")),
- Gtk2::Label->new($intf->{domain} || $netc->{DOMAINNAME} || 'none'),
+ Gtk2::Label->new($intf->{domain} || $net->{resolv}{DOMAINNAME} || 'none'),
),
),
);
@@ -365,7 +361,7 @@ sub build_notebook {
delete $gui->{intf}{BOOTPROTO};
}
!$intf->{IPADDR} and ($intf->{IPADDR}, $gui->{active}, $intf->{NETMASK}) = get_intf_ip($interface_name);
- $gui->{netc}{$_}->set_text($netc->{$_}) foreach keys %{$gui->{netc}};
+ $gui->{netc}{$_}->set_text($net->{$_}) foreach keys %{$gui->{netc}};
}
if ($intf->{pages}{DHCP}) {
@@ -636,7 +632,7 @@ sub populate_notebook {
}
sub save {
- my ($netc, $p, $apply_button) = @_;
+ my ($p, $apply_button) = @_;
my $dialog = _create_dialog(N("Please wait"));
gtkpack($dialog->vbox,
@@ -647,8 +643,8 @@ sub save {
Glib::Timeout->add(200, sub {
gtkflush();
foreach (keys %$p) {
- save_notebook($netc, $p->{$_}{intf}, $p->{$_}{gui}) or return;
- $p->{$_}{intf}{save} ? $p->{$_}{intf}{save}->() : apply($netc, $p->{$_}{intf});
+ save_notebook($p->{$_}{intf}, $p->{$_}{gui}) or return;
+ $p->{$_}{intf}{save} ? $p->{$_}{intf}{save}->() : apply($p->{$_}{intf});
}
system("/etc/rc.d/init.d/network restart");
$dialog->response(0);
@@ -661,9 +657,9 @@ sub save {
}
sub save_notebook {
- my ($netc, $intf, $gui) = @_;
+ my ($intf, $gui) = @_;
- $netc->{$_} = $gui->{netc}{$_}->get_text foreach keys %{$gui->{netc}};
+ $net->{$_} = $gui->{netc}{$_}->get_text foreach keys %{$gui->{netc}};
$gui->{intf}{$_} and $intf->{$_} = $gui->{intf}{$_}->get_text foreach keys %{$gui->{intf}};
$gui->{intf_radio}{$_} and $intf->{$_} = $gui->{intf_radio}{$_} foreach keys %{$gui->{intf_radio}};
$intf->{$_} = bool2yesno($gui->{intf_bool}{$_}->get_active) foreach keys %{$gui->{intf_bool}};
@@ -683,7 +679,7 @@ sub save_notebook {
return 0;
}
}
- if ($netc->{GATEWAY} && !is_ip($netc->{GATEWAY})) {
+ if ($net->{network}{GATEWAY} && !is_ip($net->{network}{GATEWAY})) {
$in->ask_warn(N("Error"), N("Gateway address should be in format 1.2.3.4"));
return 0;
}
@@ -692,13 +688,13 @@ sub save_notebook {
sub add_intf() {
$::isWizard = 1;
- network::netconnect::main($netcnx, $in, $modules_conf, $netc, undef, $intf);
+ network::netconnect::safe_main($net, $in, $modules_conf);
$in->exit(0);
}
sub del_intf() {
my ($intf2delete, $failure);
- if (!keys %$intf) {
+ if (!keys %{$net->{ifcfg}}) {
$in->ask_warn(N("Error"), N("No ethernet network adapter has been detected on your system. Please run the hardware configuration tool."));
$in->exit(0);
}
@@ -713,9 +709,9 @@ sub del_intf() {
no_back => 1,
name => N("Select the network interface to remove:"),
data => [ { label => N("Net Device"), val => \$intf2delete, allow_empty_list => 1,
- list => [ keys %$intf ],
+ list => [ keys %{$net->{ifcfg}} ],
format => sub {
- my $type = network::tools::get_interface_type($intf->{$_[0]});
+ my $type = network::tools::get_interface_type($net->{ifcfg}{$_[0]});
$ethernet_names{$_[0]} || ($type ? "$type ($_[0])" : $_[0]);
}
}
@@ -764,7 +760,7 @@ sub get_intf_ip {
$mask = /Mask:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/mso ? $1 : N("No Mask");
$state = /inet/ ? N("up") : N("down");
} else {
- $ip = $intf->{$interface}{IPADDR};
+ $ip = $net->{ifcfg}{$interface}{IPADDR};
$state = "n/a";
}
($ip, $state, $mask);
@@ -782,7 +778,7 @@ sub update_list {
}
foreach my $interface (@new_intf) {
my ($ip, $state) = get_intf_ip($interface);
- $tree_model->set($intf{$interface}, map_index { $::i => $_ } (gtkcreate_pixbuf("eth_card_mini2.png"), $interface, $ip , $intf->{$interface}{BOOTPROTO}, $new_intf{$interface}, $state));
+ $tree_model->set($intf{$interface}, map_index { $::i => $_ } (gtkcreate_pixbuf("eth_card_mini2.png"), $interface, $ip , $net->{ifcfg}{$interface}{BOOTPROTO}, $new_intf{$interface}, $state));
}
foreach my $i (difference2([ keys %intf ], \@new_intf)) {
$tree_model->remove($intf{$i});
@@ -791,13 +787,10 @@ sub update_list {
}
sub apply {
- my ($netc, $intf) = @_;
+ my ($intf) = @_;
my $dyn = $intf->{BOOTPROTO} ne 'static';
- my $lintf = $intf;
- #- always delete NETWORK and BROADCAST fields so that they get automatically recomputed by write_interface_conf
- delete $lintf->{$_} foreach qw(NETWORK BROADCAST), if_($dyn, qw(IPADDR NETMASK));
- network::network::sethostname($netc) if $dyn;
- network::network::configureNetwork2($in, $modules_conf, '', $netc, { $lintf->{DEVICE} => $lintf });
+ network::network::sethostname($net) if $dyn;
+ network::network::configure_network($net, $in, $modules_conf);
}
sub ethisup { `LC_ALL=C LANGUAGE=C /sbin/ifconfig $_[0]` =~ /inet/ }
@@ -814,8 +807,8 @@ my $to_update;
sub update() {
my $h = chomp_(`hostname`);
$label_host->set_label($h);
- $int_label->set($netcnx->{type} eq 'lan' ? N("Gateway:") : N("Interface:"));
- $int_name->set($netcnx->{type} eq 'lan' ? $netc->{GATEWAY} : $netcnx->{NET_INTERFACE});
+ $int_label->set($net->{type} eq 'lan' ? N("Gateway:") : N("Interface:"));
+ $int_name->set($net->{type} eq 'lan' ? $net->{network}{GATEWAY} : $net->{net_interface});
update_list($modules_conf);
update_intbutt() if $isconnected != -1;
1;
@@ -830,11 +823,11 @@ sub in_ifconfig {
sub update2() {
undef $to_update;
- connected_bg(\$to_update);
+ network::tools::connected_bg(\$to_update);
if (defined $to_update) {
$isconnected = $to_update;
if ($isconnected != -1) {
- if ($isconnected && !in_ifconfig($netcnx->{NET_INTERFACE})) {
+ if ($isconnected && !in_ifconfig($net->{net_interface})) {
$warning_label1->set(N("Warning, another Internet connection has been detected, maybe using your network"));
$isconnected = 0;
} else { $warning_label1->set("") }
@@ -906,12 +899,12 @@ Configure them first by clicking on 'Configure'")));
# Eth${_}Driver = $all_cards[$_]->[1]
my $interface = $all_cards[$_][0];
my ($ip, undef, $mask) = get_intf_ip($interface);
- $mask ||= $intf->{$interface}{NETMASK};
+ $mask ||= $net->{ifcfg}{$interface}{NETMASK};
@conf_data = ([ N("IP address"), \$ip ],
[ N("Netmask"), \$mask ],
- [ N("Boot Protocol"), \$intf->{$interface}{BOOTPROTO}, ["static", "dhcp", "bootp"] ],
- [ N("Started on boot"), \$intf->{$interface}{ONBOOT} , ["yes", "no"] ],
- [ N("DHCP client"), \$intf->{$interface}{DHCP_CLIENT} ]
+ [ N("Boot Protocol"), \$net->{ifcg}{$interface}{BOOTPROTO}, ["static", "dhcp", "bootp"] ],
+ [ N("Started on boot"), \$net->{ifcg}{$interface}{ONBOOT} , ["yes", "no"] ],
+ [ N("DHCP client"), \$net->{ifcfg}{$interface}{DHCP_CLIENT} ]
);
my $i = 0;
my $size_group = Gtk2::SizeGroup->new('horizontal');
@@ -969,12 +962,12 @@ Configure them first by clicking on 'Configure'")));
my @infos = @{$card_tab[2*$_]};
each_index { ${$_->[1]} = $infos[2*$::i+1]->get_text } @{$card_tab[2*$_+1]};
my $interface = $all_cards[$_][0];
- if ($intf->{$interface}{BOOTPROTO} ne "static") {
- delete @{$intf->{$interface}}{qw(IPADDR NETWORK NETMASK BROADCAST)};
+ if ($net->{ifcfg}{$interface}{BOOTPROTO} ne "static") {
+ delete @{$net->{ifcfg}{$interface}}{qw(IPADDR NETWORK NETMASK BROADCAST)};
} else {
if ($infos[1]->get_text ne "No ip") {
- $intf->{$interface}{IPADDR} = $infos[1]->get_text;
- $intf->{$interface}{NETMASK} = $infos[3]->get_text;
+ $net->{ifcfg}{$interface}{IPADDR} = $infos[1]->get_text;
+ $net->{ifcfg}{$interface}{NETMASK} = $infos[3]->get_text;
}
}
}
@@ -987,17 +980,16 @@ Configure them first by clicking on 'Configure'")));
$window->show_all;
foreach (0..$#all_cards) {
my @infos = @{$card_tab[2*$_]};
- $intf->{$all_cards[$_][0]}{BOOTPROTO} eq "dhcp" or $infos[8]->hide;
+ $net->{ifcfg}{$all_cards[$_][0]}{BOOTPROTO} eq "dhcp" or $infos[8]->hide;
}
$window->run;
}
-sub configure_net {
- my ($netcnx, $netc, $_intf) = @_;
+sub configure_net() {
my $dialog = ugtk2->new('drakconnect');
my $exit_dialogsub = sub { Gtk2->main_quit };
- if (!$netcnx->{type}) {
+ if (!$net->{type}) {
$in->ask_warn(
N("Warning"),
#-PO: here "Add Connection" should be translated the same was as in control-center
@@ -1005,8 +997,6 @@ sub configure_net {
Run the \"%s\" assistant from the Mandriva Linux Control Center", N("Set up a new network interface (LAN, ISDN, ADSL, ...)")));
$in->exit;
}
- my $cnx = {};
- $cnx = $netcnx->{$netcnx->{type}};
unless ($::isEmbedded) {
$dialog->{rwindow}->set_position('center');
$dialog->{rwindow}->set_title(N("Internet connection configuration"));
@@ -1019,15 +1009,15 @@ Run the \"%s\" assistant from the Mandriva Linux Control Center", N("Set up a ne
my $i = 0;
#- duplicated code (waiting for 9.1 to be out to merge everything correctly, avoid bug elsewhere).
- if ($netcnx->{type} =~ /adsl/) {
+ if ($net->{type} eq 'adsl') {
require network::adsl;
- network::adsl::adsl_probe_info($cnx, $netc, $intf);
+ network::adsl::adsl_probe_info($net);
}
my @conf_data = (
- [ N("Host name (optional)"), \$netc->{HOSTNAME} ],
- [ N("First DNS Server (optional)"), \$netc->{dnsServer} ], # \$cnx->{dns1}
- [ N("Second DNS Server (optional)"), \$netc->{dnsServer2} ], #\$cnx->{dns2}
- [ N("Third DNS server (optional)"), \$netc->{dnsServer3} ],
+ [ N("Host name (optional)"), \$net->{network}{HOSTNAME} ],
+ [ N("First DNS Server (optional)"), \$net->{resolv}{dnsServer} ],
+ [ N("Second DNS Server (optional)"), \$net->{resolv}{dnsServer2} ],
+ [ N("Third DNS server (optional)"), \$net->{reslov}{dnsServer3} ],
);
my @infos;
gtkpack($param_vbox,
@@ -1053,7 +1043,7 @@ Run the \"%s\" assistant from the Mandriva Linux Control Center", N("Set up a ne
1, gtkadd(gtkcreate_frame(N("Internet access")),
gtkset_border_width(create_packtable({ col_spacings => 5, row_spacings => 5, homogenous => 1 },
[ Gtk2::Label->new(N("Connection type: ")),
- Gtk2::Label->new(translate($netcnx->{type})) ],
+ Gtk2::Label->new(translate($net->{type})) ],
[ $int_label, $int_name ],
[ Gtk2::Label->new(N("Status:")),
$int_state = Gtk2::Label->new(N("Testing your connection...")) ]
@@ -1072,8 +1062,7 @@ Run the \"%s\" assistant from the Mandriva Linux Control Center", N("Set up a ne
update();
$button_apply->set_sensitive(1);
} else {
- configureNetwork2($in, $modules_conf, '', $netc, $intf);
- write_resolv_conf("/etc/resolv.conf", $netc);
+ network::network::configure_network($net, $in, $modules_conf);
}
$exit_dialogsub->();
}),
diff --git a/perl-install/standalone/drakpxe b/perl-install/standalone/drakpxe
index a3a3f78bc..dba934265 100755
--- a/perl-install/standalone/drakpxe
+++ b/perl-install/standalone/drakpxe
@@ -47,9 +47,8 @@ my $direct = grep { /-direct/ } @ARGV;
#my $shorewall = network::shorewall::read();
#
#- get network configuration.
-my $netc = {};
-my $intf = {};
-network::network::read_all_conf('', $netc, $intf);
+my $net = {};
+network::network::read_net_conf($net);
my $in = 'interactive'->vnew('su');
$::Wizard_title = N("PXE Server Configuration");
@@ -126,7 +125,7 @@ my @intf = grep { exists $_->{NETWORK} } map {
print STDERR "$s\n";
$s =~ /^(\S+)\s+\S+\s+$_->{NETMASK}\s+.*$_->{DEVICE}/ and $_->{NETWORK} = $1;
}
- } $_ } values %$intf;
+ } $_ } values %{$net->{ifcfg}};
if (@intf < 1) {
#- no interface already configured found, ask user to configure.
$in->ask_warn(N("No network adapter on your system!"),
@@ -149,7 +148,7 @@ if (@intf < 1) {
step_ip_range:
#- read current configuration, or create a default suitable automatically.
-my $dhcpd_conf = parse_dhcpd_conf("/etc/dhcpd.conf", {}, $netc, $intf[0]);
+my $dhcpd_conf = parse_dhcpd_conf("/etc/dhcpd.conf", {}, $net, $intf[0]);
#- get back default of ip.
my $pool;
@@ -252,10 +251,10 @@ foreach my $i (0..99) {
}
defined $label or $label = "halt$i", last;
}
-my $server = $intf[0]{IPADDR} || $netc->{HOSTNAME};
+my $server = $intf[0]{IPADDR} || $net->{network}{HOSTNAME};
push @{$pxelinux_cfg->{entry}}, { label => $label,
kernel => "images/alt0/vmlinuz",
- append => "initrd=images/alt0/all.rdz ramdisk=32000 vga=788 ".($auto_inst_cfg ? "kickstart=$auto_inst_cfg " : "")."automatic=method:http,network:dhcp,interface:eth0,dns:$netc->{dnsServer},server:$server,directory:$dir root=/dev/ram3" };
+ append => "initrd=images/alt0/all.rdz ramdisk=32000 vga=788 ".($auto_inst_cfg ? "kickstart=$auto_inst_cfg " : "")."automatic=method:http,network:dhcp,interface:eth0,dns:$net->{resolv}{dnsServer},server:$server,directory:$dir root=/dev/ram3" };
build_pxelinux_cfg($pxelinux_cfg, "/var/lib/tftpboot/PXEClient/pxelinux.cfg/default");
#- make directory available for httpd.
@@ -269,7 +268,7 @@ start_daemons();
#- sub for reading/writing dhcpd.conf and pxelinux.cfg/default...
sub parse_dhcpd_conf {
- my ($file, undef, $netc, $intf) = @_;
+ my ($file, undef, $net, $intf) = @_;
my (%dhcpd_conf, $pool);
local (*F, $_);
@@ -277,7 +276,8 @@ sub parse_dhcpd_conf {
$dhcpd_conf{class_PXE} = 'PXE';
$dhcpd_conf{class} = { PXE => undef, Etherboot => undef, known => undef };
add2hash($dhcpd_conf{network} = { pool => [] }, $intf);
- add2hash($dhcpd_conf{network}, $netc);
+ add2hash($dhcpd_conf{network}, $net->{network});
+ add2hash($dhcpd_conf{network}, $net->{resolv});
if (open F, $file) {
while (<F>) {
diff --git a/perl-install/standalone/finish-install b/perl-install/standalone/finish-install
index 653ddf24a..ac904f8ff 100755
--- a/perl-install/standalone/finish-install
+++ b/perl-install/standalone/finish-install
@@ -6,13 +6,15 @@ use common;
use interactive;
use any;
use authentication;
+use network::network;
use network::netconnect;
use security::level;
$ENV{SHARE_PATH} ||= "/usr/share";
my $authentication = authentication::get();
my $security = security::level::get();
-network::netconnect::read_net_conf(my $netcnx = {}, my $netc = {}, my $intf = {});
+my $net = {};
+network::network::read_net_conf($net);
$::isWizard = 1;
my $in = 'interactive'->vnew;
@@ -29,19 +31,19 @@ sub ask_language() {
sub ask_network() {
my $modules_conf = modules::any_conf->read;
require network::netconnect;
- network::netconnect::real_main($netcnx, $in, $modules_conf, $netc, undef, $intf);
+ network::netconnect::real_main($net, $in, $modules_conf);
}
sub ask_authentication() {
my $meta_class = { getVarsFromSh("/etc/sysconfig/system") }->{META_CLASS};
my $superuser = {};
- authentication::ask_root_password_and_authentication($in, $netc, $superuser, $authentication, $meta_class, $security);
+ authentication::ask_root_password_and_authentication($in, $net, $superuser, $authentication, $meta_class, $security);
authentication::set_root_passwd($superuser, $authentication);
eval {
- authentication::set($in, $netc, $authentication);
- network::network::write_conf($netc);
+ authentication::set($in, $net, $authentication);
+ network::network::write_network_conf($net);
};
if (my $err = $@) {
$in->ask_warn(N("Error"), formatError($err));
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet
index 28d7c8e11..1311da3fe 100644
--- a/perl-install/standalone/net_applet
+++ b/perl-install/standalone/net_applet
@@ -6,7 +6,7 @@ use c;
use common;
use standalone;
use Digest::MD5;
-use network::netconnect;
+use network::network;
use network::tools;
use mygtk2 qw(gtknew);
@@ -27,9 +27,7 @@ is_running('net_applet') and die "net_applet already running\n";
my $prog_name = "/usr/bin/net_applet";
my $current_md5 = md5file($prog_name);
-my $netcnx = {};
-my $netc = {};
-my $intf = {};
+my $net = {};
my $watched_interface;
$SIG{HUP} = sub {
@@ -72,7 +70,7 @@ my %actions = (
'confNetwork' => { name => N("Configure Network"), launch => sub { system("/usr/sbin/drakconnect --skip-wizard &") } },
'chooseInterface' => {
name => N("Watched interface"),
- choices => sub { N("Auto-detect"), sort keys %$intf },
+ choices => sub { N("Auto-detect"), sort keys %{$net->{ifcfg}} },
choice_selected => sub { $watched_interface ? $_[0] eq $watched_interface : $_[0] eq N("Auto-detect") },
launch => sub {
$watched_interface = $_[0] eq N("Auto-detect") ? undef : $_[0];
@@ -82,10 +80,10 @@ my %actions = (
'chooseProfile' => {
name => N("Profiles"),
choices => sub { network::network::netprofile_list() },
- choice_selected => sub { $_[0] eq $netc->{PROFILE} },
+ choice_selected => sub { $_[0] eq $net->{PROFILE} },
launch => sub {
- $netc->{PROFILE} = $_[0];
- network::tools::bg_command_as_root('/sbin/set-netprofile', $netc->{PROFILE});
+ $net->{PROFILE} = $_[0];
+ network::tools::bg_command_as_root('/sbin/set-netprofile', $net->{PROFILE});
}
},
'refresh' => { name => N("Refresh"), launch => sub { checkNetworkForce() } },
@@ -161,27 +159,18 @@ sub netMonitor() {
sub checkNetwork() {
my ($gw_intf, $_is_up, $gw_address) = $watched_interface ?
($watched_interface, network::tools::get_interface_status($watched_interface)) :
- network::tools::get_internet_connection($netc, $intf);
+ network::tools::get_internet_connection($net);
go2State($gw_address ? 'connected' : $gw_intf ? 'disconnected' : 'notconfigured', $gw_intf);
my $new_md5 = md5file($prog_name);
if ($new_md5 ne $current_md5) { exec($prog_name) }
}
sub checkNetworkForce() {
- $netcnx = {};
- $netc = {};
- $intf = {};
- network::netconnect::read_net_conf($netcnx, $netc, $intf);
+ $net = {};
+ network::network::read_net_conf($net);
undef $current_state;
checkNetwork();
}
-sub getIP {
- my ($interface) = shift;
- my $ifconfig = '/sbin/ifconfig';
- my @lines = `$ifconfig $interface`;
- my @ip = map { if_(/inet adr:([\d.]+)/, $1) } @lines;
- return wantarray() ? @ip : $ip[0];
-}
sub cronNetwork() {
$timeout = Glib::Timeout->add(2000, sub {
checkNetwork();
diff --git a/perl-install/standalone/net_monitor b/perl-install/standalone/net_monitor
index 240a67049..9904d08b2 100755
--- a/perl-install/standalone/net_monitor
+++ b/perl-install/standalone/net_monitor
@@ -29,25 +29,22 @@ use c;
use interactive;
use ugtk2 qw(:create :helpers :wrappers);
use common;
-use network::netconnect;
+use network::network;
use network::tools;
-use MDK::Common::Globals "network", qw($in);
use POSIX;
$ugtk2::wm_icon = "/usr/share/mcc/themes/default/net_monitor-mdk.png";
-if ("@ARGV" =~ /--status/) { print connected(); exit(0) }
+if ("@ARGV" =~ /--status/) { print network::tools::connected(); exit(0) }
my $force = "@ARGV" =~ /--force/;
my $quiet = "@ARGV" =~ /--quiet/;
my $connect = "@ARGV" =~ /--connect/;
my $disconnect = "@ARGV" =~ /--disconnect/;
my ($default_intf) = "@ARGV" =~ /--defaultintf (\w+)/;
-my $netcnx = {};
-my $netc = {};
-my $intf = {};
-network::netconnect::read_net_conf($netcnx, $netc, $intf);
-$default_intf ||= network::tools::get_default_gateway_interface($netc, $intf);
+my $net = {};
+network::network::read_net_conf($net);
+$default_intf ||= $net->{default}{interface};
if ($force) {
$connect and network::tools::start_interface($default_intf);
@@ -313,7 +310,7 @@ sub rescan() {
$monitor->{sta} = 0;
$monitor->{nba} = 0;
}
- $label_cnx_type->set_label(translate($netcnx->{type}));
+ $label_cnx_type->set_label(translate($net->{type}));
$monitor->{$_} = 0 foreach 'sr', 'st';
1;
}
@@ -461,17 +458,17 @@ sub update() {
}
@interfaces = @intfs;
if ($isconnected != -2 && $isconnected != -1 && !$during_connection) {
- if ($isconnected == 1 && !in_ifconfig($netcnx->{NET_INTERFACE})) {
+ if ($isconnected == 1 && !in_ifconfig($net->{net_interface})) {
$isconnected = 0;
$statusbar->pop(1);
$statusbar->push(1, N("Warning, another internet connection has been detected, maybe using your network"));
} else {
- #- translators : $netcnx->{type} is the type of network connection (modem, adsl...)
+ #- translators : $net->{type} is the type of network connection (modem, adsl...)
$statusbar->pop(1);
$statusbar->push(1, $isconnected == 1 ? N("Connected") : N("Not connected"));
}
$button_connect->set_sensitive(1);
- $button_connect->set("label", $isconnected == 1 ? N("Disconnect %s", translate($netcnx->{type})) : N("Connect %s", $netcnx->{type}));
+ $button_connect->set("label", $isconnected == 1 ? N("Disconnect %s", translate($net->{type})) : N("Connect %s", $net->{type}));
}
unless ($default_intf || @interfaces) {
$button_connect->set_sensitive(0);