From 578dc4f6c9e3f302ad839fa011bdf4bf85a5ef9b Mon Sep 17 00:00:00 2001 From: damien Date: Wed, 4 Jul 2001 23:20:35 +0000 Subject: modularized. It compiles, runs, and works for some stuff. --- perl-install/network/adsl.pm | 2 +- perl-install/network/ethernet.pm | 5 ++--- perl-install/network/isdn.pm | 10 +++++----- perl-install/network/modem.pm | 4 ++-- perl-install/network/netconnect.pm | 18 ++++++++++++------ perl-install/network/network.pm | 2 +- perl-install/network/tools.pm | 2 +- 7 files changed, 24 insertions(+), 19 deletions(-) (limited to 'perl-install') diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm index 03f6aade7..12daed505 100644 --- a/perl-install/network/adsl.pm +++ b/perl-install/network/adsl.pm @@ -6,7 +6,7 @@ use network::tools; use network::ethernet; use vars qw(@ISA @EXPORT); -use globals "network", qw($in $prefix $install); +use globals "network", qw($in $prefix $install $connect_file $disconnect_file); @ISA = qw(Exporter); @EXPORT = qw(adsl_ask_info adsl_detect adsl_conf adsl_conf_backend); diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm index 52b4afd70..f4e81c512 100644 --- a/perl-install/network/ethernet.pm +++ b/perl-install/network/ethernet.pm @@ -7,10 +7,10 @@ use detect_devices; use common qw(:file :common); use run_program; use vars qw(@ISA @EXPORT); -use globals "network", qw($in $prefix $install); +use globals "network", qw($in $prefix $install $connect_file $disconnect_file); @ISA = qw(Exporter); -@EXPORT = qw(conf_network_card conf_network_card_backend go_ethernet); +@EXPORT = qw(configureNetwork conf_network_card conf_network_card_backend go_ethernet); sub configure_cable { my ($netcnx, $netc, $intf, $first_time) = @_; @@ -189,7 +189,6 @@ ifdown $netc->{NET_DEVICE} sub configureNetwork { my ($netc, $intf, $first_time) = @_; - print "plop3 -- $prefix \n"; local $_; any::setup_thiskind($in, 'net', !$::expert, 1); my @l = detect_devices::getNet() or die _("no network card found"); diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm index 39a9ac820..f67c6aac1 100644 --- a/perl-install/network/isdn.pm +++ b/perl-install/network/isdn.pm @@ -6,7 +6,7 @@ use modules; use log; use network::tools; use vars qw(@ISA @EXPORT); -use globals "network", qw($in $prefix $install); +use globals "network", qw($in $prefix $install; $connect_file $disconnect_file); @ISA = qw(Exporter); @EXPORT = qw(isdn_write_config isdn_write_config_backend get_info_providers_backend isdn_ask_info isdn_ask_protocol isdn_ask isdn_detect isdn_detect_backend isdn_get_list isdn_get_info); @@ -191,7 +191,7 @@ If you have a PCMCIA card, you have to know the irq and io of your card. $e = $in->ask_from_listf(_("ISDN Configuration"), _("Which is your ISDN card ?"), sub { $_[0]{description} }, - [ grep {$_->{card} eq $isdn->{card_type}; } @isdndata ] ) or goto isdn_ask_step_1; + [ grep {$_->{card} eq $isdn->{card_type}; } @network::netconnect::isdndata ] ) or goto isdn_ask_step_1; $isdn->{driver}='hisax'; $e->{$_} and $isdn->{$_} = $e->{$_} foreach qw(type mem io io0 io1 irq); @@ -236,7 +236,7 @@ sub isdn_detect_backend { $isdn->{$_} = $c->{$_} foreach qw(description vendor id driver options); $isdn->{$_} = sprintf("%0x", $isdn->{$_}) foreach ('vendor', 'id'); $isdn->{card_type} = 'pci'; - $isdn->{type} = $isdnid2type{$isdn->{vendor} . $isdn->{id}}; #If the card is not listed, type is void. You have to ask it then. + $isdn->{type} = $network::netconnect::isdnid2type{$isdn->{vendor} . $isdn->{id}}; #If the card is not listed, type is void. You have to ask it then. } } @@ -244,7 +244,7 @@ sub isdn_detect_backend { #- output : descriptions : list of strings sub isdn_get_list { - map { $_->{description} } @isdndata; + map { $_->{description} } @network::netconnect::isdndata; } #- isdn_get_info : return isdn card infos. This function is not use internally. @@ -253,7 +253,7 @@ sub isdn_get_list { sub isdn_get_info { my ($desc) = @_; - foreach (@isdndata) { + foreach (@network::netconnect::isdndata) { return $_ if ($_->{description} eq $desc); } } diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm index 8f281922c..66faab9ec 100644 --- a/perl-install/network/modem.pm +++ b/perl-install/network/modem.pm @@ -7,7 +7,7 @@ use detect_devices; use mouse; use network::tools; use vars qw(@ISA @EXPORT); -use globals "network", qw($in $prefix $install); +use globals "network", qw($in $prefix $install $connect_file $disconnect_file); @ISA = qw(Exporter); @EXPORT = qw(pppConfig modem_detect_backend); @@ -55,7 +55,7 @@ sub pppConfig { { label => _("First DNS Server (optional)"), val => \$modem->{dns1} }, { label => _("Second DNS Server (optional)"), val => \$modem->{dns2} }, ]) or return; - any::pppConfig($modem, $install); + any::pppConfig($in, $modem, $prefix, $install); $netc->{$_}='ppp0' foreach 'NET_DEVICE', 'NET_INTERFACE'; 1; } diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index 4f34daa84..03b7d7fd5 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -3,7 +3,7 @@ package network::netconnect; use diagnostics; use strict; -use vars qw($in $install $prefix $isdn_init @isdndata %isdnid2type $connect_file $disconnect_file $connect_prog); +use vars qw($isdn_init @isdndata %isdnid2type); use common qw(:common :file :functional :system); use log; @@ -18,11 +18,8 @@ use commands; #require Data::Dumper; use network::tools; -use globals "network", qw($in $prefix $install); +use globals "network", qw($in $prefix $install $connect_file $disconnect_file $connect_prog); -$connect_file = "/etc/sysconfig/network-scripts/net_cnx_up"; -$disconnect_file = "/etc/sysconfig/network-scripts/net_cnx_down"; -$connect_prog = "/etc/sysconfig/network-scripts/net_cnx_pg"; #- intro is called only in standalone. sub intro { @@ -30,6 +27,9 @@ sub intro { my ($netc, $mouse, $intf) = ({}, {}, {}); my $text; my $connected; + my $connect_file = "/etc/sysconfig/network-scripts/net_cnx_up"; + my $disconnect_file = "/etc/sysconfig/network-scripts/net_cnx_down"; + my $connect_prog = "/etc/sysconfig/network-scripts/net_cnx_pg"; read_net_conf($prefix, $netcnx, $netc); if (!$::isWizard) { if (connected($netc)) { @@ -85,7 +85,13 @@ sub detect { sub main { my ($prefix, $netcnx, $netc, $mouse, $in, $intf, $install, $first_time, $direct_fr) = @_; - globals::init(in => $in, prefix => $prefix, install => $install); + globals::init( + in => $in, + prefix => $prefix, + install => $install, + connect_file => "/etc/sysconfig/network-scripts/net_cnx_up", + disconnect_file => "/etc/sysconfig/network-scripts/net_cnx_down", + connect_prog => "/etc/sysconfig/network-scripts/net_cnx_pg" ); $netc->{minus_one}=0; #When one configure an eth in dhcp without gateway $::isInstall and $in->set_help('configureNetwork'); $::isStandalone and read_net_conf($netcnx, $netc); # REDONDANCE with intro. FIXME diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 61f43bd99..ecfadfb8d 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -16,7 +16,7 @@ use log; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); -@EXPORT = qw(resolv configureNetworkIntf netmask dns is_ip configureNetwork masked_ip findIntf addDefaultRoute all write_interface_conf read_all_conf dnsServers guessHostname configureNetworkNet read_resolv_conf getVarsFromSh read_interface_conf add2hosts gateway configureNetwork2 write_conf sethostname miscellaneousNetwork down_it read_conf write_resolv_conf up_it); +@EXPORT = qw(resolv configureNetworkIntf netmask dns is_ip masked_ip findIntf addDefaultRoute all write_interface_conf read_all_conf dnsServers guessHostname configureNetworkNet read_resolv_conf getVarsFromSh read_interface_conf add2hosts gateway configureNetwork2 write_conf sethostname miscellaneousNetwork down_it read_conf write_resolv_conf up_it); #-###################################################################################### #- Functions diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm index 284f89bda..3cbbfdcd2 100644 --- a/perl-install/network/tools.pm +++ b/perl-install/network/tools.pm @@ -3,7 +3,7 @@ package network::tools; use common qw(:common :file); use run_program; use vars qw(@ISA @EXPORT); -use globals "network", qw($in $prefix $install); +use globals "network", qw($in $prefix $install $disconnect_file $connect_prog); @ISA = qw(Exporter); @EXPORT = qw(write_secret_backend ask_connect_now connect_backend disconnect_backend read_providers_backend ask_info2 connected disconnected); -- cgit v1.2.1