summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorMystery Man <unknown@mandriva.org>2002-07-23 11:21:56 +0000
committerMystery Man <unknown@mandriva.org>2002-07-23 11:21:56 +0000
commit882ed9f801f347b87e162777b296d5be79b8b7ba (patch)
treeb3ee4e9e881f5bda8d243626aac2bea772f25e68 /perl-install/network
parent127a73d935d78af53d3dadd05d4636f6b717976d (diff)
downloaddrakx-882ed9f801f347b87e162777b296d5be79b8b7ba.tar
drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.tar.gz
drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.tar.bz2
drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.tar.xz
drakx-882ed9f801f347b87e162777b296d5be79b8b7ba.zip
This commit was manufactured by cvs2svn to create tag 'V1_1_8_9mdk'.V1_1_8_9mdk
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/adsl.pm172
-rw-r--r--perl-install/network/ethernet.pm216
-rw-r--r--perl-install/network/isdn.pm276
-rw-r--r--perl-install/network/isdn_consts.pm326
-rw-r--r--perl-install/network/modem.pm91
-rw-r--r--perl-install/network/netconnect.pm629
-rw-r--r--perl-install/network/network.pm460
-rw-r--r--perl-install/network/nfs.pm66
-rw-r--r--perl-install/network/smb.pm150
-rw-r--r--perl-install/network/smbnfs.pm58
-rw-r--r--perl-install/network/tools.pm227
11 files changed, 0 insertions, 2671 deletions
diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm
deleted file mode 100644
index bf5a63475..000000000
--- a/perl-install/network/adsl.pm
+++ /dev/null
@@ -1,172 +0,0 @@
-package network::adsl;
-
-use common;
-use run_program;
-use network::tools;
-use network::ethernet;
-use modules;
-
-use vars qw(@ISA @EXPORT);
-use MDK::Common::Globals "network", qw($in $prefix);
-
-@ISA = qw(Exporter);
-@EXPORT = qw(adsl_ask_info adsl_detect adsl_conf adsl_conf_backend);
-
-sub configure {
- my ($netcnx, $netc, $intf, $first_time) = @_;
- $::isInstall and $in->set_help('configureNetworkADSL');
- conf_adsl_step1:
- my $type = $in->ask_from_list_(_("Connect to the Internet"),
- _("The most common way to connect with adsl is pppoe.
-Some connections use pptp, a few ones use dhcp.
-If you don't know, choose 'use pppoe'"), [__("use pppoe"), __("use pptp"), __("use dhcp"), __("Alcatel speedtouch usb")]) or return;
- $type =~ s/use //;
- if ($type eq 'pppoe') {
- $in->do_pkgs->install("rp-$type");
- $netcnx->{type} = "adsl_$type";
- $netcnx->{"adsl_$type"} = {};
- adsl_conf($netcnx->{"adsl_$type"}, $netc, $intf, $type) or goto conf_adsl_step1;
- #-network::configureNetwork($prefix, $netc, $in, $intf, $first_time);
-# if ($::isStandalone and $netc->{NET_DEVICE}) {
-# $in->ask_yesorno(_("Network interface"),
-# _("I'm about to restart the network device %s. Do you agree?", $netc->{NET_DEVICE}), 1)
-# and system("$prefix/sbin/ifdown $netc->{NET_DEVICE}; $prefix/sbin/ifup $netc->{NET_DEVICE}");
-# }
- }
- if ($type eq 'dhcp') {
- $in->do_pkgs->install(qw(dhcpcd));
- go_ethernet($netc, $intf, 'dhcp', '', '', $first_time) or goto conf_adsl_step1;
- }
- if ($type eq 'pptp') {
- $in->do_pkgs->install(qw(pptp-adsl));
- $netcnx->{type} = "adsl_$type";
- $netcnx->{"adsl_$type"} = {};
- adsl_conf($netcnx->{"adsl_$type"}, $netc, $intf, $type) or goto conf_adsl_step1;
- }
- if ($type =~ /speedtouch/) {
- $type = 'speedtouch';
- $in->do_pkgs->install(qw(speedtouch));
- $netcnx->{type} = "adsl_$type";
- $netcnx->{"adsl_$type"} = {};
- $netcnx->{"adsl_$type"}{vpivci} = '';
- adsl_conf($netcnx->{"adsl_$type"}, $netc, $intf, $type) or goto conf_adsl_step1;
- }
- $type =~ /speedtouch/ or $netconnect::need_restart_network = 1;
- 1;
-}
-
-sub adsl_ask_info {
- my ($adsl, $netc, $intf) = @_;
- add2hash($netc, { dnsServer2 => '', dnsServer3 => '', DOMAINNAME2 => '' });
- add2hash($adsl, { login => '', passwd => '', passwd2 => '' });
- ask_info2($adsl, $netc);
-}
-
-#- adsl_detect : detect adsl modem on a given interface
-#- input :
-#- $interface : interface where the modem is supposed to be connected : should be "ethx"
-#- output:
-#- true/false : success|failed
-sub adsl_detect {
- return 0;
- my ($interface) = @_;
- run_program::rooted($prefix, "ifconfig $interface 10.0.0.10 netmask 255.255.255.0");
- my $ret=run_program::rooted($prefix, "/bin/ping -c 1 10.0.0.138 2> /dev/null");
- run_program::rooted($prefix, "ifconfig $interface 0.0.0.0 netmask 255.255.255.0");
- run_program::rooted($prefix, "/etc/init.d/network restart");
- $ret;
-}
-
-sub adsl_conf {
- my ($adsl, $netc, $intf, $adsl_type) = @_;
-
- adsl_conf_step_1:
- adsl_ask_info ($adsl, $netc, $intf) or return;
- adsl_conf_step_2:
- $adsl_type eq 'speedtouch' or conf_network_card($netc, $intf, 'static' , '10.0.0.10' ) or goto adsl_conf_step_1;
- adsl_conf_backend($adsl, $netc, $adsl_type);
- 1;
-}
-
-sub adsl_conf_backend {
- my ($adsl, $netc, $adsl_type, $netcnx) = @_;
- defined $netcnx and $netc->{adsltype} = $netcnx->{type};
- $netc->{adsltype} ||= "adsl_$adsl_type";
- mkdir_p("$prefix/etc/ppp");
- output("$prefix/etc/ppp/options",
-'lock
-noipdefault
-persist
-noauth
-usepeerdns
-defaultroute
-') if $adsl_type =~ /pptp|pppoe|speedtouch/;
-
- write_secret_backend($adsl->{login}, $adsl->{passwd});
-
- if ($adsl_type eq 'pppoe') {
- substInFile {
- s/ETH=.*\n/ETH=$netc->{NET_DEVICE}\n/;
- s/USER=.*\n/USER=$adsl->{login}\n/;
- } "$prefix/etc/ppp/pppoe.conf";
- }
-
- if ($adsl_type eq 'speedtouch') {
- $netc->{vpivci} =~ /(\d+)_(\d+)/;
- output("$prefix/etc/ppp/peers/adsl",
-qq{noauth
-noipdefault
-pty "/usr/bin/pppoa3 -vpi $1 -vci $2"
-sync
-kdebug 1
-noaccomp
-nopcomp
-noccp
-novj
-holdoff 4
-maxfail 25
-persist
-usepeerdns
-defaultroute
-user "$adsl->{login}"
-});
- modules::add_alias($_->[0], $_->[1]) foreach (['char-major-108', 'ppp_generic'],
- ['tty-ldisc-3', 'ppp_async'],
- ['tty-ldisc-13', 'n_hdlc'],
- ['tty-ldisc-14', 'ppp_synctty'],
- ['ppp-compress-21', 'bsd_comp'],
- ['ppp-compress-24', 'ppp_deflate'],
- ['ppp-compress-26', 'ppp_deflate']);
- $::isStandalone and modules::write_conf($prefix);
- $in->do_pkgs->what_provides("speedtouch_mgmt") and $in->do_pkgs->install('speedtouch_mgmt');
- -e "$prefix/usr/share/speedtouch/mgmt.o" or $in->ask_warn('', _('You need the alcatel microcode.
-Download it at
-http://www.alcatel.com/consumer/dsl/dvrreg_lx.htm
-and copy the mgmt.o in /usr/share/speedtouch'));
- }
-
- if ($adsl_type eq 'pptp') {
- write_cnx_script($netc, "adsl",
-"/sbin/route del default
-/usr/bin/pptp 10.0.0.138 name $adsl->{login}
-",
-'/usr/bin/killall pptp pppd
-', $netc->{adsltype}) } elsif ($adsl_type eq 'pppoe') {
- write_cnx_script($netc, "adsl",
-"/sbin/route del default
-LC_ALL=C LANG=C LANGUAGE=C LC_MESSAGES=C /usr/sbin/adsl-start $netc->{NET_DEVICE} $adsl->{login}
-",
-'/usr/sbin/adsl-stop
-/usr/bin/killall pppoe pppd
-', $netc->{adsltype}) } elsif ($adsl_type eq 'speedtouch') {
- write_cnx_script($netc, 'adsl',
-'/sbin/route del default
-/usr/share/speedtouch/speedtouch.sh start
-',
-'/usr/share/speedtouch/speedtouch.sh stop
-', $netc->{adsltype}) }
-
- $netc->{NET_INTERFACE}='ppp0';
-}
-
-1;
diff --git a/perl-install/network/ethernet.pm b/perl-install/network/ethernet.pm
deleted file mode 100644
index e25cb7e68..000000000
--- a/perl-install/network/ethernet.pm
+++ /dev/null
@@ -1,216 +0,0 @@
-package network::ethernet;
-
-use network::network;
-use modules;
-use any;
-use detect_devices;
-use common;
-use run_program;
-use network::tools;
-use vars qw(@ISA @EXPORT);
-use MDK::Common::Globals "network", qw($in $prefix);
-
-@ISA = qw(Exporter);
-@EXPORT = qw(configureNetwork conf_network_card conf_network_card_backend go_ethernet);
-
-sub configure_cable {
- my ($netcnx, $netc, $intf, $first_time) = @_;
- $::isInstall and $in->set_help('configureNetworkCable');
- $netcnx->{type}='cable';
- # $netcnx->{cable}={};
- # $in->ask_from_entries_ref(_("Cable connection"),
- # _("Please enter your host name if you know it.
- # Some DHCP servers require the hostname to work.
- # Your host name should be a fully-qualified host name,
- # such as ``mybox.mylab.myco.com''."),
- # [_("Host name:")], [ \$netcnx->{cable}{hostname} ]);
- if ($::expert) {
- my @m=(
- { description => "dhcpcd",
- c => 1},
- { description => "dhcpxd",
- c => 3},
- { description => "dhcp-client",
- c => 4},
- );
- if (my $f = $in->ask_from_listf(_("Connect to the Internet"),
- _("Which dhcp client do you want to use?
-Default is dhcpcd"),
- sub { $_[0]{description} },
- \@m )) {
- $f->{c}==1 and $netcnx->{dhcp_client}="dhcpcd" and $in->do_pkgs->install(qw(dhcpcd));
- $f->{c}==3 and $netcnx->{dhcp_client}="dhcpxd" and $in->do_pkgs->install(qw(dhcpxd));
- $f->{c}==4 and $netcnx->{dhcp_client}="dhcp-client" and $in->do_pkgs->install(qw(dhcp-client));
- }
- } else {
- $in->do_pkgs->install(qw(dhcpcd));
- }
- go_ethernet($netc, $intf, 'dhcp', '', '', $first_time);
- write_cnx_script($netc, "cable",
-qq(
-/sbin/ifup $netc->{NET_DEVICE}
-),
-qq(
-/sbin/ifdown $netc->{NET_DEVICE}
-), $netcnx->{type});
- 1;
-}
-
-sub configure_lan {
- my ($netcnx, $netc, $intf, $first_time) = @_;
- $::isInstall and $in->set_help('configureNetworkIP');
- configureNetwork($netc, $intf, $first_time) or return;
- configureNetwork2($in, $prefix, $netc, $intf);
- $netc->{NETWORKING} = "yes";
- if ($netc->{GATEWAY} || grep { $_->{BOOTPROTO} eq 'dhcp' } values %$intf) {
- $netcnx->{type}='lan';
- $netcnx->{NET_DEVICE} = $netc->{NET_DEVICE} = '';
- $netcnx->{NET_INTERFACE} = 'lan'; #$netc->{NET_INTERFACE};
- write_cnx_script($netc, "local network",
-qq(
-/etc/rc.d/init.d/network restart
-),
-qq(
-/etc/rc.d/init.d/network stop
-/sbin/ifup lo
-), $netcnx->{type});
- }
- $::isStandalone and modules::write_conf($prefix);
- 1;
-}
-
-sub conf_network_card {
- my ($netc, $intf, $type, $ipadr, $netadr) = @_;
- #-type =static or dhcp
- any::load_category($in, 'network/main|usb', !$::expert, 1);
- my @all_cards=conf_network_card_backend($netc, $intf, $type, undef, $ipadr, $netadr);
- my $interface;
- @all_cards == () and $in->ask_warn('', _("No ethernet network adapter has been detected on your system.
-I cannot set up this connection type.")) and return;
- @all_cards == 1 and $interface = $all_cards[0]->[0] and goto l1;
- again :
- $interface = $in->ask_from_list(_("Choose the network interface"),
- _("Please choose which network adapter you want to use to connect to Internet"),
- [ map { $_->[0] . ($_->[1] ? " ( using module $_->[1] )" : "") } @all_cards ]
- ) or return;
- defined $interface or goto again;
- l1:
- $::isStandalone and modules::write_conf($prefix);
-
- my $device=conf_network_card_backend($netc, $intf, $type, $interface, $ipadr, $netadr, $interface);
-# if ( $::isStandalone and !($type eq "dhcp")) {
-# $in->ask_yesorno(_("Network interface"),
-# _("I'm about to restart the network device:\n") . $device . _("\nDo you agree?"), 1) and configureNetwork2($in, $prefix, $netc, $intf) and system("$prefix/sbin/ifdown $device;$prefix/sbin/ifup $device");
-# }
- 1;
-}
-
-#- conf_network_card_backend : configure the network cards and return the list of them, or configure one specified interface : WARNING, you have to setup the ethernet cards, by calling load_category($in, 'network/main|usb', !$::expert, 1) or load_category_backend before calling this function. Basically, you call this function in 2 times.
-#- input
-#- $prefix
-#- $netc
-#- $intf
-#- $type : type of interface, must be given if $interface is : string : "static" or "dhcp"
-#- $interface : facultative, if given, set this interface and return it in a proper form. If not, return @all_cards
-#- $ipadr : facultative, ip address of the interface : string
-#- $netadr : facultative, netaddress of the interface : string
-#- when $interface is given, informations are written in $intf and $netc. If not, @all_cards is returned.
-#- $intf output: $device is the result of
-#- $intf->{$device}->{DEVICE} : which device is concerned : $device is the result of $interface =~ /(eth[0-9]+)/; my $device = $1;;
-#- $intf->{$device}->{BOOTPROTO} : $type
-#- $intf->{$device}->{NETMASK} : '255.255.255.0'
-#- $intf->{$device}->{NETWORK} : $netadr
-#- $intf->{$device}->{ONBOOT} : "yes"
-#- $netc output:
-#- $netc->{nb_cards} : nb of ethernet cards
-#- $netc->{NET_DEVICE} : this is used to indicate that this eth card is used to connect to internet : $device
-#- output:
-#- $all_cards : a list of a list ( [eth1, module1], ... , [ethn, modulen]). Pass the ethx as $interface in further call.
-#- $device : only returned in case $interface was given it's $interface, but filtered by /eth[0-9+]/ : string : /eth[0-9+]/
-sub conf_network_card_backend {
- my ($netc, $intf, $type, $interface, $ipadr, $netadr) = @_;
- #-type =static or dhcp
- if (!$interface) {
- my @all_cards = detect_devices::getNet();
- $netc->{nb_cards} = @all_cards;
-
- my @devs = detect_devices::pcmcia_probe();
- modules::mergein_conf("$prefix/etc/modules.conf");
- my $saved_driver;
- return map {
- my $interface = $_;
- my $a = modules::get_alias($interface);
- my $b;
- foreach (@devs) {
- $_->{device} eq $interface and $b = $_->{driver};
- }
- $a ||= $b;
- if ($a) { $saved_driver = $a }
- [$interface, $saved_driver];
- } @all_cards;
- }
- my ($device) = $interface =~ /(eth[0-9]+)/ or die("the interface is not an ethx");
- $netc->{NET_DEVICE} = $device; #- one consider that there is only ONE Internet connection device..
-
- @{$intf->{$device}}{qw(DEVICE BOOTPROTO NETMASK NETWORK ONBOOT)} =
- ($device, $type, '255.255.255.0', $netadr, 'yes');
-
- $intf->{$device}->{IPADDR} = $ipadr if $ipadr;
- $device;
-}
-
-sub go_ethernet {
- my ($netc, $intf, $type, $ipadr, $netadr, $first_time) = @_;
- conf_network_card($netc, $intf, $type, $ipadr, $netadr) or return;
- $netc->{NET_INTERFACE}=$netc->{NET_DEVICE};
- configureNetwork($netc, $intf, $first_time) or return;
-# if ( $::isStandalone and $netc->{NET_DEVICE}) {
-# $in->ask_yesorno(_("Network interface"),
-# _("I'm about to restart the network device %s. Do you agree?", $netc->{NET_DEVICE}), 1) and system("$prefix/sbin/ifdown $netc->{NET_DEVICE}; $prefix/sbin/ifup $netc->{NET_DEVICE}");
-# }
- 1;
-}
-
-sub configureNetwork {
- my ($netc, $intf, $first_time) = @_;
- local $_;
- any::load_category($in, 'network/main|usb', !$::expert, 1);
- my @l = detect_devices::getNet() or die _("no network card found");
- my @all_cards = conf_network_card_backend ($netc, $intf, undef, undef, undef, undef);
-
- configureNetwork_step_1:
- my $n_card=0;
- $netc ||= {};
- my $last; foreach (@l) {
- my $intf2 = findIntf($intf ||= {}, $_);
- add2hash($intf2, $last);
- add2hash($intf2, { NETMASK => '255.255.255.0' });
- configureNetworkIntf($netc, $in, $intf2, $netc->{NET_DEVICE}, 0, $all_cards[$n_card]->[1]) or return;
-
- $last = $intf2;
- $n_card++;
- }
- #- {
- #- my $wait = $o->wait_message(_("Hostname"), _("Determining host name and domain..."));
- #- network::guessHostname($o->{prefix}, $o->{netc}, $o->{intf});
- #- }
- $last or return;
- if ($last->{BOOTPROTO} =~ /^(dhcp|bootp)$/) {
- $netc->{minus_one} = 1;
- my $dhcp_hostname = $netc->{HOSTNAME};
- $::isInstall and $in->set_help('configureNetworkHostDHCP');
- $in->ask_from(_("Configuring network"),
-_("Please enter your host name if you know it.
-Some DHCP servers require the hostname to work.
-Your host name should be a fully-qualified host name,
-such as ``mybox.mylab.myco.com''."),
- [ { label => _("Host name"), val => \$netc->{HOSTNAME} }]) or goto configureNetwork_step_1;
- $netc->{HOSTNAME} ne $dhcp_hostname and $netc->{DHCP_HOSTNAME} = $netc->{HOSTNAME};
- } else {
- configureNetworkNet($in, $netc, $last ||= {}, @l) or goto configureNetwork_step_1;
- }
- miscellaneousNetwork($in);
- 1;
-}
-
-1;
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
deleted file mode 100644
index 1ab029b87..000000000
--- a/perl-install/network/isdn.pm
+++ /dev/null
@@ -1,276 +0,0 @@
-package network::isdn;
-
-use network::isdn_consts;
-use common;
-use any;
-use modules;
-use run_program;
-use log;
-use network::tools;
-use vars qw(@ISA @EXPORT);
-use MDK::Common::Globals "network", qw($in $prefix);
-use MDK::Common::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);
-
-sub configure {
- my ($netcnx, $netc) = @_;
- isdn_step_1:
- defined $netc->{autodetect}{isdn}{id} and goto intern_pci;
- $::isInstall and $in->set_help('configureNetworkISDN');
- my $e = $in->ask_from_list_(_("Network Configuration Wizard"),
- _("What kind is your ISDN connection?"), [ __("Internal ISDN card"), __("External ISDN modem")]
- ) or return;
- if ($e =~ /card/) {
- intern_pci:
- $netc->{isdntype}='isdn_internal';
- $netcnx->{isdn_internal}={};
- $netcnx->{isdn_internal}{$_} = $netc->{autodetect}{isdn}{$_} foreach ('description', 'vendor', 'id', 'driver', 'card_type', 'type');
- isdn_detect($netcnx->{isdn_internal}, $netc) or return;
- } else {
- $netc->{isdntype}='isdn_external';
- $netcnx->{isdn_external}={};
- $netcnx->{isdn_external}{device}=$netc->{autodetect}{modem};
- $netcnx->{isdn_external}{special_command}='AT&F&O2B40';
- require network::modem;
- network::modem::pppConfig($netcnx->{isdn_external}, $mouse, $netc) or goto isdn_step_1;
- }
- 1;
-}
-
-sub isdn_write_config {
- my ($isdn, $netc) = @_;
- isdn_write_config_step_1:
- my $e = $in->ask_from_list_(_("Network Configuration Wizard"),
- _("Which ISDN configuration do you prefer?
-
-* The Old configuration uses isdn4net. It contains powerfull
- tools, but is tricky to configure, and not standard.
-
-* The New configuration is easier to understand, more
- standard, but with less tools.
-
-We recommand the light configuration.
-"), [ __("New configuration (isdn-light)"), __("Old configuration (isdn4net)")]
- ) or return;
- my ($rmpackage, $instpackage) = $e =~ /light/ ? ('isdn4net', 'isdn-light') : ('isdn-light', 'isdn4net');
- if (!$::isStandalone) {
- require pkgs;
- my $p = pkgs::packageByName($in->{packages}, $rmpackage);
- $p && $p->flag_selected and pkgs::unselectPackage($in->{packages}, $p);
- }
- run_program::rooted($prefix, "rpm", "-e", "$rmpackage");
- $in->do_pkgs->install($instpackage, if_($isdn->{speed} =~ /128/, 'ibod'), 'isdn4k-utils');
- my $light = $e =~ /light/ ? 1 : 0;
- isdn_write_config_backend($isdn, $light, $netc);
- 1;
-}
-
-sub isdn_write_config_backend {
- my ($isdn, $light, $netc, $netcnx) = @_;
- defined $netcnx and $netc->{isdntype} = $netcnx->{type};
- if ($light) {
- modules::mergein_conf("$prefix/etc/modules.conf");
- if ($isdn->{id}) {
- isdn_detect_backend($isdn);
- } else {
- my $a="";
- defined $isdn->{$_} and $a .= "$_=" . $isdn->{$_} . " " foreach qw(type protocol mem io io0 io1 irq);
- $isdn->{driver} eq "hisax" and $a.="id=HiSax";
- modules::set_options($isdn->{driver}, $a);
- }
- modules::add_alias("ippp0", $isdn->{driver});
- $::isStandalone and modules::write_conf($prefix);
- foreach my $f ('ioptions1B', 'ioptions2B') {
- substInFile { s/^name .*\n//; $_ .= "name $isdn->{login}\n" if eof } "$prefix/etc/ppp/$f";
- chmod 0600, $f;
- }
- foreach my $f ('isdn1B.conf', 'isdn2B.conf') {
- my $a=1;
- substInFile {
- s/EAZ =.*/EAZ = $isdn->{phone_in}/;
- s/PHONE_OUT =.*/PHONE_OUT = $isdn->{phone_out}/;
- if (/NAME = ippp0/ .. /PPPBIND = 0/) {
- s/HUPTIMEOUT =.*/HUPTIMEOUT = $isdn->{huptimeout}/;
- }
- } "$prefix/etc/isdn/$f";
- chmod 0600, $f;
- }
- my $bundle = $isdn->{speed} =~ /64/ ? "1B" : "2B";
- symlinkf("isdn" . $bundle . ".conf", "$prefix/etc/isdn/isdnctrl.conf");
- symlinkf("ioptions" . $bundle, "$prefix/etc/ppp/ioptions");
- } else {
- my $f = "$prefix/etc/isdn/profile/link/myisp";
- output ($f,
- qq(
-I4L_USERNAME="$isdn->{login}"
-I4L_SYSNAME=""
-I4L_LOCALMSN="$isdn->{phone_in}"
-I4L_REMOTE_OUT="$isdn->{phone_out}"
-I4L_DIALMODE="$isdn->{dialing_mode}"
-) . if_($isdn->{speed} =~ /128/, 'SLAVE="ippp1"
-'));
- chmod 0600, $f;
-
- output "$prefix/etc/isdn/profile/card/mycard",
- qq(
-I4L_MODULE="$isdn->{driver}"
-I4L_TYPE="$isdn->{type}"
-I4L_IRQ="$isdn->{irq}"
-I4L_MEMBASE="$isdn->{mem}"
-I4L_PORT="$isdn->{io}"
-I4L_IO0="$isdn->{io0}"
-I4L_IO1="$isdn->{io1}"
-I4L_ID="HiSax"
-I4L_FIRMWARE="$isdn->{firmware}"
-);
-
- output "$prefix/etc/ppp/ioptions",
- "lock
-usepeerdns
-defaultroute
-";
- system "$prefix/etc/rc.d/init.d/isdn4linux restart";
- }
-
- substInFile { s/^FIRMWARE.*\n//; $_ .= qq(FIRMWARE="$isdn->{firmware}"\n) if eof } "$prefix/etc/sysconfig/network-scripts/ifcfg-ippp0";
-
- write_secret_backend($isdn->{login}, $isdn->{passwd});
-
- write_cnx_script($netc, "isdn",
-"/sbin/route del default
-/sbin/ifup ippp0
-/sbin/isdnctrl dial ippp0
-" . if_($isdn->{speed} =~ /128/, "service ibod restart
-"),
-"/sbin/isdnctrl hangup ippp0
-/sbin/ifdown ippp0
-" . if_($isdn->{speed} =~ /128/, "service ibod stop
-"), $netc->{isdntype});
- 1;
-}
-
-sub get_info_providers_backend {
- my ($isdn, $netc, $name, $file) = @_;
- $name eq 'Unlisted - edit manually' and return;
- foreach (catMaybeCompressed($file)) {
- chop;
- my ($name_, $phone, $real, $dns1, $dns2) = split '=>';
- if ($name eq $name_) {
- @{$isdn}{qw(user_name phone_out DOMAINNAME2 dnsServer3 dnsServer2)} =
- ((split(/\|/, $name_))[2], $phone, $real, $dns1, $dns2);
- }
- }
-}
-
-sub isdn_ask_info {
- my ($isdn, $netc) = @_;
- my $f = "$ENV{SHARE_PATH}/ldetect-lst/isdn.db";
- $f = "$prefix$f" if !-e $f;
- my $str= $in->ask_from_treelist( _("ISDN Configuration"), _("Select your provider.\nIf it isn't listed, choose Unlisted."),
- '|', ['Unlisted - edit manually',
- read_providers_backend($f)], 'Unlisted - edit manually')
- or return;
- get_info_providers_backend($isdn, $netc, $str || 'Unlisted - edit manually', $f);
- $isdn->{huptimeout} = 180;
- $isdn->{$_} ||= '' foreach qw(phone_in phone_out dialing_mode login passwd passwd2 idl speed);
- add2hash($netc, { dnsServer2 => '', dnsServer3 => '', DOMAINNAME2 => '' });
- ask_info2($isdn, $netc);
-}
-
-sub isdn_ask_protocol {
- my @toto=(
- { description => $::expert ? _("Europe protocol (EDSS1)") : _("Europe protocol"),
- protokol => 2},
- { description => $::expert ? _("Protocol for the rest of the world\nNo D-Channel (leased lines)") : _("Protocol for the rest of the world"),
- protokol => 3}
- );
- my $e = $in->ask_from_listf(_("ISDN Configuration"),
- _("Which protocol do you want to use?"),
- sub { $_[0]{description} },
- \@toto ) or return 0;
- $e->{protokol};
-}
-
-sub isdn_ask {
- my ($isdn, $netc, $label) = @_;
- isdn_ask_step_1:
- my $e = $in->ask_from_list_(_("ISDN Configuration"),
- $label . "\n" . _("What kind of card do you have?"),
- [ __("ISA / PCMCIA"), __("PCI"), __("I don't know") ]
- ) or return;
- if ($e =~ /PCI/) {
- $isdn->{card_type} = 'pci';
- } else {
- $in->ask_from_list_(_("ISDN Configuration"),
- _("
-If you have an ISA card, the values on the next screen should be right.\n
-If you have a PCMCIA card, you have to know the \"irq\" and \"io\" of your card.
-"),
- [ __("Continue"), __("Abort") ]) eq 'Continue' or goto isdn_ask_step_1;
- $isdn->{card_type} = 'isa';
- }
-
- isdn_ask_step_2:
- $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;
- $e->{$_} and $isdn->{$_} = $e->{$_} foreach qw(driver type mem io io0 io1 irq firmware);
-
- isdn_ask_step_3:
- $isdn->{protocol} = isdn_ask_protocol() or goto isdn_ask_step_2;
- isdn_ask_step_4:
- isdn_ask_info($isdn, $netc) or goto isdn_ask_step_3;
- isdn_write_config($isdn, $netc) or goto isdn_ask_step_4;
- 1;
-}
-
-sub isdn_detect {
- my ($isdn, $netc) = @_;
- if ($isdn->{id}) {
- log::l("found isdn card : $isdn->{description}; vendor : $isdn->{vendor};id : $isdn->{id}; driver : $isdn->{driver}\n");
- $isdn->{description} =~ s/\|/ -- /;
- if ($isdn->{type} eq '') {
- isdn_ask($isdn, $netc, _("I have detected an ISDN PCI card, but I don't know its type. Please select a PCI card on the next screen.")) or return;
- } else {
- isdn_detect_step_1:
- $isdn->{protocol}=isdn_ask_protocol() or return;
- isdn_detect_step_2:
- isdn_ask_info($isdn, $netc) or goto isdn_detect_step_1;
- isdn_write_config($isdn, $netc) or goto isdn_detect_step_2;
- }
- } else {
- isdn_ask($isdn, $netc, _("No ISDN PCI card found. Please select one on the next screen.")) or return;
- }
- $netc->{$_}='ippp0' foreach 'NET_DEVICE', 'NET_INTERFACE';
- 1;
-}
-
-sub isdn_detect_backend {
- my ($isdn) = @_;
- if (my ($c) = (modules::probe_category('network/isdn'))) {
- $isdn->{$_} = $c->{$_} foreach qw(description vendor id driver options firmware);
- $isdn->{$_} = sprintf("%0x", $isdn->{$_}) foreach ('vendor', 'id');
- $isdn->{card_type} = 'pci';
- ($isdn->{type}) = $isdn->{options} =~ /type=(\d+)/;
-# $c->{options} !~ /id=HiSax/ && $isdn->{driver} eq "hisax" and $c->{options} .= " id=HiSax";
- if ($c->{options} !~ /protocol=/ && $isdn->{protocol} =~ /\d/) {
- modules::set_options($c->{driver}, $c->{options} . " protocol=" . $isdn->{protocol});
- }
- $c->{options} =~ /protocol=(\d)/ and $isdn->{protocol} = $1;
- }
-}
-
-sub isdn_get_list {
- map { $_->{description} } @isdndata;
-}
-
-sub isdn_get_info {
- my ($desc) = @_;
- foreach (@isdndata) {
- return $_ if ($_->{description} eq $desc);
- }
-}
-
-1;
diff --git a/perl-install/network/isdn_consts.pm b/perl-install/network/isdn_consts.pm
deleted file mode 100644
index 357da529a..000000000
--- a/perl-install/network/isdn_consts.pm
+++ /dev/null
@@ -1,326 +0,0 @@
-package network::isdn; # $Id$
-
-@isdndata =
- (
- {description => "Teles 16.0 (ISA)", #1 irq, mem, io
- driver => 'hisax',
- type => '1',
- irq => '5',
- mem => '0xd000',
- io => '0xd80',
- card => 'isa',
- },
- {description => "Teles 8.0 (ISA)", #2 irq, mem
- driver => 'hisax',
- type => '2',
- irq => '9',
- mem => '0xd800',
- card => 'isa',
- },
- {description => "Teles 16.3 (ISA non PnP)", #3 irq, io
- driver => 'hisax',
- type => '3',
- irq => '9',
- io => '0xd80',
- card => 'isa',
- },
- {description => "Teles 16.3c (ISA PnP)", #14 irq, io
- driver => 'hisax',
- type => '14',
- irq => '9',
- io => '0xd80',
- card => 'isa',
- },
- {description => "Creatix/Teles (ISA PnP)", #4 irq, io0 (ISAC), io1 (HSCX)
- driver => 'hisax',
- type => '4',
- irq => '5',
- io0 => '0x0000',
- io1 => '0x0000',
- card => 'isa',
- },
- {description => "Teles generic (PCI)", #21 no parameter
- driver => 'hisax',
- type => '21',
- card => 'pci',
- },
- {description => "Teles 16.3 (PCMCIA)", #8 irq, io
- driver => 'hisax',
- type => '8',
- irq => '',
- io => '0x',
- card => 'isa',
- },
- {description => "Teles S0Box", #25 irq, io (of the used lpt port)
- driver => 'hisax',
- type => '25',
- irq => '7',
- io => '0x378',
- card => 'isa',
- },
- {description => "ELSA PCC/PCF cards (ISA)", #6 io or nothing for autodetect (the io is required only if you have n>1 ELSA card )
- driver => 'hisax',
- type => '6',
- io => "",
- card => 'isa',
- },
- {description => "ELSA Quickstep 1000 (ISA)", #7 irq, io (from isapnp setup)
- driver => 'hisax',
- type => '7',
- irq => '5',
- io => '0x300',
- card => 'isa',
- },
- {description => "ELSA Quickstep 1000 (PCI)", #18 no parameter
- driver => 'hisax',
- type => '18',
- card => 'pci',
- },
- {description => "ELSA Quickstep 3000 (PCI)", #18 no parameter
- driver => 'hisax',
- type => '18',
- card => 'pci',
- },
- {description => "ELSA generic (PCMCIA)", #10 irq, io (set with card manager)
- driver => 'hisax',
- type => '10',
- irq => '',
- io => '0x',
- card => 'isa',
- },
- {description => "ELSA MicroLink (PCMCIA)", #10 irq, io (set with card manager)
- driver => 'elsa_cs',
- card => 'isa',
- },
- {description => "ITK ix1-micro Rev.2 (ISA)", #9 irq, io
- driver => 'hisax',
- type => '9',
- irq => '9',
- io => '0xd80',
- card => 'isa',
- },
- {description => "Eicon.Diehl Diva (ISA PnP)", #11 irq, io
- driver => 'hisax',
- type => '11',
- irq => '9',
- io => '0x180',
- card => 'isa',
- },
- {description => "Eicon.Diehl Diva 20 (PCI)", #11 no parameter
- driver => 'hisax',
- type => '11',
- card => 'pci',
- },
- {description => "Eicon.Diehl Diva 20PRO (PCI)", #11 no parameter
- driver => 'hisax',
- type => '11',
- card => 'pci',
- },
- {description => "Eicon.Diehl Diva 20_U (PCI)", #11 no parameter
- driver => 'hisax',
- type => '11',
- card => 'pci',
- },
- {description => "Eicon.Diehl Diva 20PRO_U (PCI)", #11 no parameter
- driver => 'hisax',
- type => '11',
- card => 'pci',
- },
- {description => "ASUS COM ISDNLink (ISA)", #12 irq, io (from isapnp setup)
- driver => 'hisax',
- type => '12',
- irq => '5',
- io => '0x200',
- card => 'isa',
- },
- {description => "ASUS COM ISDNLink (PCI)",
- driver => 'hisax',
- type => '35',
- card => 'pci',
- },
- {description => "DynaLink (PCI)",
- driver => 'hisax',
- type => '12',
- card => 'pci',
- },
- {description => "DynaLink IS64PH, ASUSCOM (PCI)", #36
- driver => 'hisax',
- type => '36',
- card => 'pci',
- },
- {description => "HFC-2BS0 based cards (ISA)", #13 irq, io
- driver => 'hisax',
- type => '13',
- irq => '9',
- io => '0xd80',
- card => 'isa',
- },
- {description => "HFC 2BDS0 (PCI)", #35 none
- driver => 'hisax',
- type => '35',
- card => 'pci',
- },
- {description => "HFC 2BDS0 S+, SP (PCMCIA)", #37 irq,io (pcmcia must be set with cardmgr)
- driver => 'hisax',
- type => '37',
- card => 'isa',
- },
- {description => "Sedlbauer Speed Card (ISA)", #15 irq, io
- driver => 'hisax',
- type => '15',
- irq => '9',
- io=> '0xd80',
- card => 'isa',
- },
- {description => "Sedlbauer PC/104 (ISA)", #15 irq, io
- driver => 'hisax',
- type => '15',
- irq => '9',
- io => '0xd80',
- card => 'isa',
- },
- {description => "Sedlbauer Speed Card (PCI)", #15 no parameter
- driver => 'hisax',
- type => '15',
- card => 'pci',
- },
- {description => "Sedlbauer Speed Star (PCMCIA)", #22 irq, io (set with card manager)
- driver => 'sedlbauer_cs',
- card => 'isa',
- },
- {description => "Sedlbauer Speed Fax+ (ISA Pnp)", #28 irq, io (from isapnp setup)
- driver => 'hisax',
- type => '28',
- irq => '9',
- io => '0xd80',
- card => 'isa',
- firmware => '/usr/lib/isdn/ISAR.BIN',
- },
- {description => "Sedlbauer Speed Fax+ (PCI)", #28 no parameter
- driver => 'hisax',
- type => '28',
- card => 'pci',
- firmware => '/usr/lib/isdn/ISAR.BIN',
- },
- {description => "USR Sportster internal (ISA)", #16 irq, io
- driver => 'hisax',
- type => '16',
- irq => '9',
- io=> '0xd80',
- card => 'isa',
- },
- {description => "MIC card (ISA)", #17 irq, io
- driver => 'hisax',
- type => '17',
- irq => '9',
- io => '0xd80',
- card => 'isa',
- },
- {description => "Compaq ISDN S0 card (ISA)", #19 irq, io0, io1, io (from isapnp setup io=IO2)
- driver => 'hisax',
- type => '19',
- irq => '5',
- io => '0x0000',
- io0 => '0x0000',
- io1 => '0x0000',
- card => 'isa',
- },
- {description => "NETjet card (PCI)", #20 no parameter
- driver => 'hisax',
- type => '20',
- card => 'pci',
- },
- {description => "Dr. Neuhaus Niccy (ISA PnP)", #24 irq, io0, io1 (from isapnp setup)
- driver => 'hisax',
- type => '24',
- irq => '5',
- io0 => '0x0000',
- io1 => '0x0000',
- card => 'isa',
- },
- {description => "Dr. Neuhaus Niccy (PCI)", ##24 no parameter
- driver => 'hisax',
- type => '24',
- card => 'pci',
- },
- {description => "AVM A1 (Fritz) (ISA non PnP)", #5 irq, io
- driver => 'hisax',
- type => '5',
- irq => '10',
- io => '0x300',
- card => 'isa',
- },
- {description => "AVM (ISA Pnp)", #27 irq, io (from isapnp setup)
- driver => 'hisax',
- type => '27',
- irq => '5',
- io => '0x300',
- card => 'isa',
- },
- {description => "AVM A1 (Fritz) (PCMCIA)", #26 irq, io (set with card manager)
- driver => 'hisax',
- type => '26',
- irq => '',
- card => 'isa',
- },
- {description => "AVM PCI (Fritz!) (PCI)", #27 no parameter
- driver => 'hisax',
- type => '27',
- card => 'pci',
- },
- {description => "AVM B1 (PCI)",
- driver => 'b1pci',
- card => 'pci',
- },
- {description => "Siemens I-Surf 1.0 (ISA Pnp)", #29 irq, io, memory (from isapnp setup)
- driver => 'hisax',
- type => '29',
- irq => '9',
- io => '0xd80',
- mem => '0xd000',
- card => 'isa',
- },
- {description => "ACER P10 (ISA Pnp)", #30 irq, io (from isapnp setup)
- driver => 'hisax',
- type => '30',
- irq => '5',
- io => '0x300',
- card => 'isa',
- },
- {description => "HST Saphir (ISA Pnp)", #31 irq, io
- driver => 'hisax',
- type => '31',
- irq => '5',
- io => '0x300',
- card => 'isa',
- },
- {description => "Telekom A4T (PCI)", #32 none
- driver => 'hisax',
- type => '32',
- card => 'pci',
- },
- {description => "Scitel Quadro (PCI)", #33 subcontroller (4*S0, subctrl 1...4)
- driver => 'hisax',
- type => '33',
- card => 'pci',
- },
- {description => "Gazel ISDN cards (ISA)", #34 irq,io
- driver => 'hisax',
- type => '34',
- irq => '5',
- io => '0x300',
- card => 'isa',
- },
- {description => "Gazel ISDN cards (PCI)", #34 none
- driver => 'hisax',
- type => '34',
- card => 'pci',
- },
- {description => "W6692 and Winbond based cards (PCI)", #36 none
- driver => 'hisax',
- type => '36',
- card => 'pci',
- },
- );
-
-1;
diff --git a/perl-install/network/modem.pm b/perl-install/network/modem.pm
deleted file mode 100644
index 046ebbf8d..000000000
--- a/perl-install/network/modem.pm
+++ /dev/null
@@ -1,91 +0,0 @@
-package network::modem;
-
-use common;
-use any;
-use modules;
-use detect_devices;
-use mouse;
-use network::tools;
-use vars qw(@ISA @EXPORT);
-use MDK::Common::Globals "network", qw($in $prefix);
-
-@ISA = qw(Exporter);
-@EXPORT = qw(pppConfig modem_detect_backend);
-
-sub configure{
- my ($netcnx, $mouse, $netc) = @_;
- $netcnx->{type}='modem';
- $netcnx->{$netcnx->{type}}={};
- $netcnx->{modem}{device}=$netc->{autodetect}{modem};
- modem_step_1:
- pppConfig($netcnx->{$netcnx->{type}}, $mouse, $netc) or return;
- write_cnx_script($netc, "modem",
-q(
-/sbin/route del default
-ifup ppp0
-),
-q(ifdown ppp0
-killall pppd
-), $netcnx->{type});
- 1;
-}
-
-sub pppConfig {
- my ($modem, $mouse, $netc) = @_;
-
- $mouse ||={};
- $mouse->{device} ||= readlink "$prefix/dev/mouse";
- $::isInstall and $in->set_help('selectSerialPort');
- $modem->{device} ||= $in->ask_from_listf('', _("Please choose which serial port your modem is connected to."),
- \&mouse::serial_port2text,
- [ grep { $_ ne $mouse->{device} } (mouse::serial_ports, if_(-e '/dev/modem', '/dev/modem')) ]) || return;
-
- $::isStandalone || $in->set_help('configureNetworkISP');
- $in->ask_from('', _("Dialup options"), [
-{ label => _("Connection name"), val => \$modem->{connection} },
-{ label => _("Phone number"), val => \$modem->{phone} },
-{ label => _("Login ID"), val => \$modem->{login} },
-{ label => _("Password"), val => \$modem->{passwd}, hidden => 1 },
-{ label => _("Authentication"), val => \$modem->{auth}, list => [ __("PAP"), __("Terminal-based"), __("Script-based"), __("CHAP") ] },
-{ label => _("Domain name"), val => \$modem->{domain} },
-{ label => _("First DNS Server (optional)"), val => \$modem->{dns1} },
-{ label => _("Second DNS Server (optional)"), val => \$modem->{dns2} },
- ]) or return;
- $netc->{DOMAINNAME2} = $modem->{domain};
- any::pppConfig($in, $modem, $prefix);
- $netc->{$_}='ppp0' foreach 'NET_DEVICE', 'NET_INTERFACE';
- 1;
-}
-#-AT&F&O2B40
-#- DialString=ATDT0231389595((
-
-#- modem_detect_backend : detects modem on serial ports and fills the infos in $modem : detects only one card
-#- input
-#- $modem
-#- $mouse : facultative, hash containing device to exclude not to test mouse port : ( device => /ttyS[0-9]/ )
-#- output:
-#- $modem->{device} : device where the modem were detected
-sub modem_detect_backend {
- my ($modem, $mouse) = @_;
- $mouse ||={};
- $mouse->{device} ||= readlink "/dev/mouse";
- my $serdev = arch() =~ /ppc/ ? "macserial" : "serial";
- eval { modules::load("$serdev") };
-
- detect_devices::probeSerialDevices();
- foreach ('modem', map { "ttyS$_" } (0..7)) {
- next if $mouse->{device} =~ /$_/;
- next unless -e "/dev/$_";
- detect_devices::hasModem("/dev/$_") and $modem->{device} = "$_", last;
- }
-
- #- add an alias for macserial on PPC
- modules::add_alias('serial', $serdev) if (arch() =~ /ppc/ && $modem->{device});
- my @devs = detect_devices::pcmcia_probe();
- foreach (@devs) {
- $_->{type} =~ /serial/ and $modem->{device} = $_->{device};
- }
-
-}
-
-1;
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
deleted file mode 100644
index 2edf23245..000000000
--- a/perl-install/network/netconnect.pm
+++ /dev/null
@@ -1,629 +0,0 @@
-
-package network::netconnect;
-
-use diagnostics;
-use strict;
-use vars qw($isdn_init @isdndata @EXPORT);
-
-use common;
-use log;
-use detect_devices;
-use run_program;
-use modules;
-use any;
-use mouse;
-use network;
-
-use network::tools;
-use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog);
-
-@EXPORT = qw(start_internet stop_internet);
-
-#- intro is called only in standalone.
-sub intro {
- my ($prefix, $netcnx, $in) = @_;
- 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()) {
- $text=_("You are currently connected to internet.") . (-e $disconnect_file ? _("\nYou can disconnect or reconfigure your connection.") : _("\nYou can reconfigure your connection."));
- $connected=1;
- } else {
- $text=_("You are not currently connected to Internet.") . (-e $connect_file ? _("\nYou can connect to Internet or reconfigure your connection.") : _("\nYou can reconfigure your connection."));
- $connected=0;
- }
- my @l=(
- !$connected && -e $connect_file ? { description => _("Connect"),
- c => 1} : (),
- $connected && -e $disconnect_file ? { description => _("Disconnect"),
- c => 2} : (),
- { description => _("Configure the connection"),
- c => 3},
- { description => _("Cancel"),
- c => 4},
- );
- my $e = $in->ask_from_listf(_("Internet connection & configuration"),
- _($text),
- sub { $_[0]{description} },
- \@l );
- run_program::rooted($prefix, $connect_prog) if ($e->{c}==1);
- run_program::rooted($prefix, $disconnect_file) if ($e->{c}==2);
- main($prefix, $netcnx, $netc, $mouse, $in, $intf, 0, 0) if ($e->{c}==3);
- $in->exit(0) if ($e->{c}==4);
- } else {
- main($prefix, $netcnx, $netc, $mouse, $in, $intf, 0, 0);
- }
-}
-
-sub detect {
- my ($auto_detect, $net_install) = @_;
- my $isdn={};
- require network::isdn;
- network::isdn->import;
- isdn_detect_backend($isdn);
- $auto_detect->{isdn}{$_}=$isdn->{$_} foreach qw(description vendor id driver card_type type);
- $auto_detect->{isdn}{description} =~ s/.*\|//;
-
- modules::load_category('network/main|usb');
- require network::ethernet;
- network::ethernet->import;
- my @all_cards = conf_network_card_backend (undef, undef, undef, undef, undef, undef);
- require network::adsl;
- network::adsl->import;
- map {
- ( !$net_install and adsl_detect($_->[0]) ) ? $auto_detect->{adsl}=$_->[0] : $auto_detect->{lan}{$_->[0]}=$_->[1]; } @all_cards;
- my $modem={};
- require network::modem;
- network::modem->import;
- modem_detect_backend($modem);#, $mouse);
- $modem->{device} and $auto_detect->{modem}=$modem->{device};
-}
-
-sub pre_func {
- my ($text) = @_;
- $in->isa('interactive_gtk') or return;
- $::Wizard_no_previous=1;
- if ($::isStandalone) {
- $::Wizard_splash=1;
- require my_gtk;
- my_gtk->import(qw(:wrappers));
- my $W = my_gtk->new(_("Network Configuration Wizard"));
- gtkadd($W->{window},
- gtkpack_(new Gtk::VBox(0, 0),
- 1, write_on_pixmap(gtkpng ("drakconnect_step"),
- 20,200,
- _("We are now going to configure the %s connection.",_($text)),
- ),
- 0, $W->create_okcancel(_("OK"))
- )
- );
- $W->main;
- $::Wizard_splash=0;
- } else {
- #- for i18n : %s is the type of connection of the list: (modem, isdn, adsl, cable, local network);
- $in->ask_okcancel(_("Network Configuration Wizard"), _("\n\n\nWe are now going to configure the %s connection.\n\n\nPress OK to continue.",_($_[0])), 1);
- }
- undef $::Wizard_no_previous;
-}
-
-sub init_globals {
- my ($in, $prefix) = @_;
- MDK::Common::Globals::init(
- in => $in,
- prefix => $prefix,
- 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" );
-}
-
-sub main {
- my ($prefix, $netcnx, $netc, $mouse, $in, $intf, $first_time, $direct_fr, $noauto) = @_;
- init_globals ($in, $prefix);
- $netc->{minus_one}=0; #When one configure an eth in dhcp without gateway
- $::isInstall and $in->set_help('configureNetwork');
- $::isStandalone and read_net_conf($prefix, $netcnx, $netc); # REDONDANCE with intro. FIXME
- $netc->{NET_DEVICE}=$netcnx->{NET_DEVICE} if $netcnx->{NET_DEVICE}; # REDONDANCE with read_conf. FIXME
- $netc->{NET_INTERFACE}=$netcnx->{NET_INTERFACE} if $netcnx->{NET_INTERFACE}; # REDONDANCE with read_conf. FIXME
- network::read_all_conf($prefix, $netc ||= {}, $intf ||= {});
-
- modules::mergein_conf("$prefix/etc/modules.conf");
-
- my $direct_net_install;
- if ($first_time && $::isInstall && ($in->{method} eq "ftp" || $in->{method} eq "http" || $in->{method} eq "nfs")) {
- (!($::expert || $noauto) or $in->ask_okcancel(_("Network Configuration"),
- _("Because you are doing a network installation, your network is already configured.
-Click on Ok to keep your configuration, or cancel to reconfigure your Internet & Network connection.
-"), 1)) and do {
- $netcnx->{type}='lan';
- output "$prefix$connect_file",
- qq(
-ifup eth0
-);
- output "$prefix$disconnect_file",
- qq(
-ifdown eth0
-);
- chmod 0755, "$prefix$disconnect_file";
- chmod 0755, "$prefix$connect_file";
- $direct_net_install = 1;
- goto step_5;
-};
- }
-
- $netc->{autodetection}=1;
- $netc->{autodetect}={};
-
- step_1:
- $::Wizard_no_previous=1;
- my @profiles=get_profiles();
- $in->ask_from(_("Network Configuration Wizard"),
- _("Welcome to The Network Configuration Wizard.
-
-We are about to configure your internet/network connection.
-If you don't want to use the auto detection, deselect the checkbox.
-"),
- [
- if_(@profiles > 1, { label => _("Choose the profile to configure"), val => \$netcnx->{PROFILE}, list => \@profiles }),
- { label => _("Use auto detection"), val => \$netc->{autodetection}, type => 'bool' },
- if_($::isStandalone, { label => _("Expert Mode"), val => \$::expert, type => 'bool' }),
- ]
- ) or goto step_5;
- undef $::Wizard_no_previous;
- set_profile($netcnx);
- if ($netc->{autodetection}) {
- my $w = $in->wait_message(_("Network Configuration Wizard"), _("Detecting devices..."));
- detect($netc->{autodetect}, $::isInstall && ($in->{method} eq "ftp" || $in->{method} eq "http" || $in->{method} eq "nfs"));
- }
-
- step_2:
-
- my $set_default;
- my %conf;
- $conf{$_} = $netc->{autodetect}{$_} ? 1 : 0 foreach 'modem', 'adsl', 'cable', 'lan';
- $conf{isdn} = $netc->{autodetect}{isdn}{description} ? 1: 0;
- my @l = (
- [_("Normal modem connection"), $netc->{autodetect}{modem}, __("detected on port %s"), \$conf{modem}],
- [_("ISDN connection"), $netc->{autodetect}{isdn}{description}, __("detected %s"), \$conf{isdn}],
- [_("ADSL connection"), $netc->{autodetect}{adsl}, __("detected on interface %s"), \$conf{adsl}],
- [_("Cable connection"), $netc->{autodetect}{cable}, __("cable connection detected"), \$conf{cable}],
- [_("LAN connection"), $netc->{autodetect}{lan}, __("ethernet card(s) detected"), \$conf{lan}]
- );
- my $i=0;
- map { defined $set_default or do { $_->[1] and $set_default=$i; }; $i++; } @l;
- @l = (
-[_("Normal modem connection") . if_($netc->{autodetect}{modem}, " - " . _("detected on port %s", $netc->{autodetect}{modem})), \$conf{modem}],
-[_("ISDN connection") . if_($netc->{autodetect}{isdn}{description}, " - " . _("detected %s", $netc->{autodetect}{isdn}{description})), \$conf{isdn}],
-[_("ADSL connection") . if_($netc->{autodetect}{adsl}, " - " . _("detected on interface %s", $netc->{autodetect}{adsl})), \$conf{adsl}],
-[_("Cable connection") . if_($netc->{autodetect}{cable}, " - " . _("cable connection detected")), \$conf{cable}],
-[_("LAN connection") . if_($netc->{autodetect}{lan}, " - " . _("ethernet card(s) detected")), \$conf{lan}]
-);
- $::isInstall and $in->set_help('configureNetwork');
- my $e = $in->ask_from(_("Network Configuration Wizard"), _("Choose the connection you want to configure"),
- [ map { { label => $_->[0], val => $_->[1], type => 'bool' } } @l ],
- changed => sub {
- return if !$netc->{autodetection};
- my $c = 0;
-#- $conf{adsl} and $c++;
- $conf{cable} and $c++;
- my $a = keys(%{$netc->{autodetect}{lan}});
- 0 < $a && $a <= $c and $conf{lan} = undef;
- }
- ) or goto step_1;
-
-# load_conf ($netcnx, $netc, $intf);
- $conf{modem} and do { pre_func("modem"); require network::modem; network::modem::configure($netcnx, $mouse, $netc) or goto step_2 };
- $conf{isdn} and do { pre_func("isdn"); require network::isdn; network::isdn::configure($netcnx, $netc) or goto step_2 };
- $conf{adsl} and do { pre_func("adsl"); require network::adsl; network::adsl::configure($netcnx, $netc, $intf, $first_time) or goto step_2};
- $conf{cable} and do { pre_func("cable"); require network::ethernet; network::ethernet::configure_cable($netcnx, $netc, $intf, $first_time) or goto step_2; $netconnect::need_restart_network = 1; };
- $conf{lan} and do { pre_func("local network"); require network::ethernet; network::ethernet::configure_lan($netcnx, $netc, $intf, $first_time) or goto step_2; $netconnect::need_restart_network = 1; };
-
- step_2_1:
- my $nb = keys %{$netc->{internet_cnx}};
- if ($nb < 1) {
- } elsif ($nb > 1) {
- $in->ask_from(_("Network Configuration Wizard"),
- _("You have configured multiple ways to connect to the Internet.\nChoose the one you want to use.\n\n" . if_(!$::isStandalone, "You may want to configure some profiles after the installation, in the Mandrake Control Center")),
- [ { label => _("Internet connection"), val => \$netc->{internet_cnx_choice}, list => [ keys %{$netc->{internet_cnx}} ]} ]
- ) or goto step_2;
- } elsif ($nb == 1) {
- $netc->{internet_cnx_choice} = (keys %{$netc->{internet_cnx}})[0];
- }
- member($netc->{internet_cnx_choice}, ('adsl', 'isdn')) and
- $netc->{at_boot} = $in->ask_yesorno(_("Network Configuration Wizard"), _("Do you want to start the connection at boot?"));
- if ($netc->{internet_cnx_choice} ) {
- write_cnx_script($netc);
- $netcnx->{type} = $netc->{internet_cnx}{$netc->{internet_cnx_choice}}{type};
- } else {
- unlink "$prefix/etc/sysconfig/network-scripts/net_cnx_up";
- unlink "$prefix/etc/sysconfig/network-scripts/net_cnx_down";
- undef $netc->{NET_DEVICE};
- }
-
- my $success = 1;
- network::configureNetwork2($in, $prefix, $netc, $intf);
- my $network_configured = 1;
-
- if ($netconnect::need_restart_network && $::isStandalone and ($::expert or $in->ask_yesorno(_("Network configuration"),
- _("The network needs to be restarted"), 1))) {
-#- run_program::rooted($prefix, "/etc/rc.d/init.d/network stop");
- if (!run_program::rooted($prefix, "/etc/rc.d/init.d/network restart")) {
- $success = 0;
- $in->ask_okcancel(_("Network Configuration"), _("A problem occured while restarting the network: \n\n%s", `/etc/rc.d/init.d/network restart`), 0);
- }
- }
-
- write_initscript();
- $::isStandalone && member($netc->{internet_cnx_choice}, ('modem', 'adsl', 'isdn')) and
- $success = ask_connect_now($netc->{internet_cnx_choice});
-
- step_3:
-
- my $m = $success ? _("Congratulations, the network and Internet configuration is finished.
-The configuration will now be applied to your system.
-
-") . if_($::isStandalone && $in->isa('interactive_gtk'),
-_("After this is done, we recommend that you restart your X environment to avoid any hostname-related problems."))
- : _("Problems occured during configuration.
-Test your connection via net_monitor or mcc. If your connection doesn't work, you might want to relaunch the configuration.");
- if ($::isWizard) {
- $::Wizard_no_previous=1;
- $::Wizard_finished=1;
- $in->ask_okcancel(_("Network Configuration"), $m, 1);
- undef $::Wizard_no_previous;
- undef $::Wizard_finished;
- } else { $::isStandalone and $in->ask_warn('', $m ); }
-
- step_5:
-
- $network_configured or network::configureNetwork2($in, $prefix, $netc, $intf);
-
- if ($netcnx->{type} =~ /modem/ || $netcnx->{type} =~ /isdn_external/) {
- output "$prefix$connect_prog",
- qq(
-#!/bin/bash
-if [ -n "\$DISPLAY" ]; then
-if [ -e /usr/bin/kppp ]; then
-/sbin/route del default
-/usr/bin/kppp &
-else
-/usr/sbin/net_monitor --connect
-fi
-else
-$connect_file
-fi
-);
- } elsif ($netcnx->{type}) {
- output "$prefix$connect_prog",
- qq(
-#!/bin/bash
-if [ -n "\$DISPLAY" ]; then
-/usr/sbin/net_monitor --connect
-else
-$connect_file
-fi
-);
- } else {
- output "$prefix$connect_prog",
- qq(
-#!/bin/bash
-/usr/sbin/drakconnect
-);
- }
- if ($direct_net_install) {
- output "$prefix$connect_prog",
- qq(
-#!/bin/bash
-if [ -n "\$DISPLAY" ]; then
-/usr/sbin/net_monitor --connect
-else
-$connect_file
-fi
-);
- }
- chmod 0755, "$prefix$connect_prog";
- $netcnx->{$_}=$netc->{$_} foreach qw(NET_DEVICE NET_INTERFACE);
-
- $netcnx->{NET_INTERFACE} and set_net_conf($netcnx, $netc);
- $netcnx->{type} =~ /adsl/ or system("/sbin/chkconfig --del adsl 2> /dev/null");
- save_conf($netcnx, $netc, $intf);
-
-#- if ($netc->{NET_DEVICE} and $netc->{NETWORKING} ne 'no' and $::isStandalone and $::expert) {
-#- exists $netc->{nb_cards} or do {
-#- any::load_category($in, 'network/main|usb', !$::expert, 1);
-#- $netc->{nb_cards} = listlength(detect_devices::getNet());
-#- };
-#- ($netc->{nb_cards} - $netc->{minus_one} - (get_net_device($prefix) =~ /eth.+/ ? 1 : 0) > 0) and $in->ask_okcancel(_("Network Configuration"),
-#-_("Now that your Internet connection is configured,
-#-your computer can be configured to share its Internet connection.
-#-Note: you need a dedicated Network Adapter to set up a Local Area Network (LAN).
-#-
-#-Would you like to setup the Internet Connection Sharing?
-#-"), 1) and system("/usr/sbin/drakgw --direct");
-#- }
-}
-
-sub save_conf {
- my ($netcnx, $netc, $intf)=@_;
- my $adsl;
- my $modem;
- my $isdn;
- $netcnx->{type} =~ /adsl/ and $adsl=$netcnx->{$netcnx->{type}};
- $netcnx->{type} eq 'isdn_external' || $netcnx->{type} eq 'modem' and $modem=$netcnx->{$netcnx->{type}};
- $netcnx->{type} eq 'isdn_internal' and $isdn=$netcnx->{$netcnx->{type}};
- modules::load_category('network/main|usb');
- require network::ethernet;
- network::ethernet->import;
- my @all_cards = conf_network_card_backend ($netc, $intf, undef, undef, undef, undef);
-
- $intf = { %$intf };
-
- output("$prefix/etc/sysconfig/network-scripts/drakconnect_conf",
- "SystemName=" . do { $netc->{HOSTNAME} =~ /([^\.]*)\./; $1 } . "
-DomainName=" . do { $netc->{HOSTNAME} =~ /\.(.*)/; $1 } . "
-InternetAccessType=" . do { if ($netcnx->{type}) { $netcnx->{type}; } else { $netc->{GATEWAY} ? "lan" : ""; } } . "
-InternetInterface=" . ($netc->{GATEWAY} && (!$netcnx->{type} || $netcnx->{type} eq 'lan') ? $netc->{NET_DEVICE} : $netcnx->{NET_INTERFACE}) . "
-InternetGateway=$netc->{GATEWAY}
-DNSPrimaryIP=$netc->{dnsServer}
-DNSSecondaryIP=$netc->{dnsServer2}
-DNSThirdIP=$netc->{dnsServer3}
-AdminInterface=
-
-" . join ('', map {
-"Eth${_}Known=" . ($intf->{"eth$_"}->{DEVICE} eq "eth$_" ? 'true' : 'false') . "
-Eth${_}IP=" . $intf->{"eth$_"}{IPADDR} . "
-Eth${_}Mask=" . $intf->{"eth$_"}{NETMASK} . "
-Eth${_}Mac=
-Eth${_}BootProto=" . $intf->{"eth$_"}{BOOTPROTO} . "
-Eth${_}OnBoot=" . $intf->{"eth$_"}{ONBOOT} . "
-Eth${_}Hostname=$netc->{HOSTNAME}
-Eth${_}HostAlias=" . do { $netc->{HOSTNAME} =~ /([^\.]*)\./; $1 } . "
-Eth${_}Driver=$all_cards[$_]->[1]
-Eth${_}Irq=
-Eth${_}Port=
-Eth${_}DHCPClient=" . ($intf->{"eth$_"}{BOOTPROTO} eq 'dhcp' ? $netcnx->{dhcp_client} : '') . "
-Eth${_}DHCPServerName=" . ($intf->{"eth$_"}{BOOTPROTO} eq 'dhcp' ? $netc->{HOSTNAME} : '') . "\n"
- } (0..9)) .
-"
-
-ISDNDriver=$isdn->{driver}
-ISDNDeviceType=$isdn->{type}
-ISDNIrq=$isdn->{irq}
-ISDNMem=$isdn->{mem}
-ISDNIo=$isdn->{io}
-ISDNIo0=$isdn->{io0}
-ISDNIo1=$isdn->{io1}
-ISDNProtocol=$isdn->{protocol}
-ISDNCardDescription=$isdn->{description}
-ISDNCardVendor=$isdn->{vendor}
-ISDNId=$isdn->{id}
-ISDNProvider=$netc->{DOMAINNAME2}
-ISDNProviderPhone=$isdn->{phone_out}
-ISDNProviderDomain=" . do { $netc->{DOMAINNAME2} =~ /\.(.*)/; $1} . "
-ISDNProviderDNS1=$netc->{dnsServer2}
-ISDNProviderDNS2=$netc->{dnsServer3}
-ISDNDialing=$isdn->{dialing_mode}
-ISDNSpeed=$isdn->{speed}
-ISDNTimeout=$isdn->{huptimeout}
-ISDNHomePhone=$isdn->{phone_in}
-ISDNLogin=$isdn->{login}
-ISDNPassword=$isdn->{passwd}
-ISDNConfirmPassword=$isdn->{passwd2}
-
-PPPInterfacesList=
-PPPDevice=$modem->{device}
-PPPDeviceSpeed=
-PPPConnectionName=$modem->{connection}
-PPPProviderPhone=$modem->{phone}
-PPPProviderDomain=$modem->{domain}
-PPPProviderDNS1=$modem->{dns1}
-PPPProviderDNS2=$modem->{dns2}
-PPPLogin=$modem->{login}
-PPPPassword=$modem->{passwd}
-PPPConfirmPassword=$modem->{passwd}
-PPPAuthentication=$modem->{auth}
-PPPSpecialCommand=" . ($netcnx->{type} eq 'isdn_external' ? $netcnx->{isdn_external}{special_command} : '' ) . "
-
-ADSLInterfacesList=
-ADSLModem=" . q( # Obsolete information. Please don't use it.) . "
-ADSLType=" . ($netcnx->{type} =~ /adsl/ ? $netcnx->{type} : '') . "
-ADSLProviderDomain=$netc->{DOMAINNAME2}
-ADSLProviderDNS1=$netc->{dnsServer2}
-ADSLProviderDNS2=$netc->{dnsServer3}
-ADSLLogin=$adsl->{login}
-ADSLPassword=$adsl->{passwd}
-DOMAINNAME2=$netc->{DOMAINNAME2}"
- );
- chmod 0600, "$prefix/etc/sysconfig/network-scripts/drakconnect_conf";
- my $a = $netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default";
- cp_af("$prefix/etc/sysconfig/network-scripts/drakconnect_conf", "$prefix/etc/sysconfig/network-scripts/drakconnect_conf." . $a);
- chmod 0600, "$prefix/etc/sysconfig/network-scripts/drakconnect_conf";
- chmod 0600, "$prefix/etc/sysconfig/network-scripts/drakconnect_conf." . $a;
- foreach ( ["$prefix$connect_file", "up"],
- ["$prefix$disconnect_file", "down"],
- ["$prefix$connect_prog", "prog"],
- ["$prefix/etc/ppp/ioptions1B", "iop1B"],
- ["$prefix/etc/ppp/ioptions2B", "iop2B"],
- ["$prefix/etc/isdn/isdn1B.conf", "isdn1B"],
- ["$prefix/etc/isdn/isdn2B.conf", "isdn2B"],
- ["$prefix/etc/resolv.conf", "resolv"],
- ["$prefix/etc/ppp/peers/adsl", "speedtouch"],
- ) {
- my $file = "$prefix/etc/sysconfig/network-scripts/net_" . $_->[1] . "." . $a;
- -e ($_->[0]) and cp_af($_->[0], $file) and chmod 0755, $file;
- }
-}
-
-sub set_profile {
- my ($netcnx, $profile) = @_;
- $profile ||= $netcnx->{PROFILE};
- $profile or return;
- my $f = "$prefix/etc/sysconfig/network-scripts/drakconnect_conf";
- -e ($f . "." . $profile) or return;
- $netcnx->{PROFILE}=$profile;
- cp_af($f . "." . $profile, $f);
- foreach ( ["$prefix$connect_file", "up"],
- ["$prefix$disconnect_file", "down"],
- ["$prefix$connect_prog", "prog"],
- ["$prefix/etc/ppp/ioptions1B", "iop1B"],
- ["$prefix/etc/ppp/ioptions2B", "iop2B"],
- ["$prefix/etc/isdn/isdn1B.conf", "isdn1B"],
- ["$prefix/etc/isdn/isdn2B.conf", "isdn2B"],
- ["$prefix/etc/resolv.conf", "resolv"],
- ["$prefix/etc/ppp/peers/adsl", "speedtouch"],
- ) {
- my $c = "$prefix/etc/sysconfig/network-scripts/net_" . $_->[1] . "." . $profile;
- -e ($c) and cp_af($c, $_->[0]);
- }
-}
-
-sub del_profile {
- my ($netcnx, $profile) = @_;
- $profile or return;
- $profile eq "default" and return;
- rm_rf("$prefix/etc/sysconfig/network-scripts/drakconnect_conf." . $profile);
- rm_rf(glob_("$prefix/etc/sysconfig/network-scripts/net_{up,down,prog,iop1B,iop2B,isdn1B,isdn2B,resolv,speedtouch}." . $profile));
-}
-
-sub add_profile {
- my ($netcnx, $profile) = @_;
- $profile or return;
- $profile eq "default" and return;
- my $cmd1 = "$prefix/etc/sysconfig/network-scripts/drakconnect_conf." . ($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
- my $cmd2 = "$prefix/etc/sysconfig/network-scripts/drakconnect_conf." . $profile;
- cp_af($cmd1, $cmd2);
-}
-
-sub get_profiles {
- my @a;
- my $i=0;
- foreach (glob("/etc/sysconfig/network-scripts/drakconnect_conf.*")) {
- s/.*\.//;
- $a[$i] = $_;
- $i++;
- }
- @a;
-}
-
-sub load_conf {
- my ($netcnx, $netc, $intf)=@_;
- my $adsl_pptp={};
- my $adsl_pppoe={};
- my $modem={};
- my $isdn_external={};
- my $isdn={};
- my $system_name;
- my $domain_name;
-
- if (-e "$prefix/etc/sysconfig/network-scripts/drakconnect_conf") {
- foreach (cat_("$prefix/etc/sysconfig/network-scripts/drakconnect_conf")) {
- /^DNSPrimaryIP=(.*)$/ and $netc->{dnsServer} = $1;
- /^DNSSecondaryIP=(.*)$/ and $netc->{dnsServer2} = $1;
- /^DNSThirdIP=(.*)$/ and $netc->{dnsServer3} = $1;
- /^InternetAccessType=(.*)$/ and $netcnx->{type} = $1;
- /^InternetInterface=(.*)$/ and $netcnx->{NET_INTERFACE} = $1;
- /^InternetGateway=(.*)$/ and $netc->{GATEWAY} = $1;
- /^SystemName=(.*)$/ and $system_name = $1;
- /^DomainName=(.*)$/ and $domain_name = $1;
- /^Eth([0-9])Known=true$/ and $intf->{"eth$1"}->{DEVICE} = "eth$1";
- /^Eth([0-9])IP=(.*)$/ && $intf->{"eth$1"}->{DEVICE} and $intf->{"eth$1"}{IPADDR} = $2;
- /^Eth([0-9])Mask=(.*)\n/ && $intf->{"eth$1"}->{DEVICE} and $intf->{"eth$1"}{NETMASK} = $2;
- /^Eth([0-9])BootProto=(.*)\n/ && $intf->{"eth$1"}->{DEVICE} and $intf->{"eth$1"}{BOOTPROTO} = $2;
- /^Eth([0-9])OnBoot=(.*)\n/ && $intf->{"eth$1"}->{DEVICE} and $intf->{"eth$1"}{ONBOOT} = $2;
- /^Eth([0-9])Hostname=(.*)\n/ && $intf->{"eth$1"}->{DEVICE} and $netc->{HOSTNAME} = $2;
- /^Eth([0-9])Driver=(.*)\n/ && $intf->{"eth$1"}->{DEVICE} and $intf->{"eth$1"}{driver} = $2;
- /^ISDNDriver=(.*)$/ and $isdn->{driver} = $1;
- /^ISDNDeviceType=(.*)$/ and $isdn->{type} = $1;
- /^ISDNIrq=(.*)/ and $isdn->{irq} = $1;
- /^ISDNMem=(.*)$/ and $isdn->{mem} = $1;
- /^ISDNIo=(.*)$/ and $isdn->{io} = $1;
- /^ISDNIo0=(.*)$/ and $isdn->{io0} = $1;
- /^ISDNIo1=(.*)$/ and $isdn->{io1} = $1;
- /^ISDNProtocol=(.*)$/ and $isdn->{protocol} = $1;
- /^ISDNCardDescription=(.*)$/ and $isdn->{description} = $1;
- /^ISDNCardVendor=(.*)$/ and $isdn->{vendor} = $1;
- /^ISDNId=(.*)$/ and $isdn->{id} = $1;
- /^ISDNProviderPhone=(.*)$/ and $isdn->{phone_out} = $1;
- /^ISDNDialing=(.*)$/ and $isdn->{dialing_mode} = $1;
- /^ISDNISDNSpeed=(.*)$/ and $isdn->{speed} = $1;
- /^ISDNTimeout=(.*)$/ and $isdn->{huptimeout} = $1;
- /^ISDNHomePhone=(.*)$/ and $isdn->{phone_in} = $1;
- /^ISDNLogin=(.*)$/ and $isdn->{login} = $1;
- /^ISDNPassword=(.*)$/ and $isdn->{passwd} = $1;
- /^ISDNConfirmPassword=(.*)$/ and $isdn->{passwd2} = $1;
-
- /^PPPDevice=(.*)$/ and $modem->{device} = $1;
- /^PPPConnectionName=(.*)$/ and $modem->{connection} = $1;
- /^PPPProviderPhone=(.*)$/ and $modem->{phone} = $1;
- /^PPPProviderDomain=(.*)$/ and $modem->{domain} = $1;
- /^PPPProviderDNS1=(.*)$/ and $modem->{dns1} = $1;
- /^PPPProviderDNS2=(.*)$/ and $modem->{dns2} = $1;
- /^PPPLogin=(.*)$/ and $modem->{login} = $1;
- /^PPPPassword=(.*)$/ and $modem->{passwd} = $1;
- /^PPPAuthentication=(.*)$/ and $modem->{auth} = $1;
- if (/^PPPSpecialCommand=(.*)$/) {
- $netcnx->{type} eq 'isdn_external' and $netcnx->{$netcnx->{type}}{special_command} = $1;
- }
- /^ADSLLogin=(.*)$/ and $adsl_pppoe->{login} = $1;
- /^ADSLPassword=(.*)$/ and $adsl_pppoe->{passwd} = $1;
- /^DOMAINNAME2=(.*)$/ and $netc->{DOMAINNAME2} = $1;
- }
- }
- $system_name && $domain_name and $netc->{HOSTNAME}=join ('.', $system_name, $domain_name);
- $adsl_pptp->{$_}=$adsl_pppoe->{$_} foreach ('login', 'passwd', 'passwd2');
- $isdn_external->{$_}=$modem->{$_} foreach ('device', 'connection', 'phone', 'domain', 'dns1', 'dns2', 'login', 'passwd', 'auth');
- $netcnx->{adsl_pptp}=$adsl_pptp;
- $netcnx->{adsl_pppoe}=$adsl_pppoe;
- $netcnx->{modem}=$modem;
- $netcnx->{modem}=$isdn_external;
- $netcnx->{isdn_internal}=$isdn;
- -e "$prefix/etc/sysconfig/network" and put_in_hash($netc,network::read_conf("$prefix/etc/sysconfig/network"));
- foreach (glob_("$prefix/etc/sysconfig/ifcfg-*")) {
- my $l = network::read_interface_conf($_);
- $intf->{$l->{DEVICE}} = $l;
- }
- my $file = "$prefix/etc/resolv.conf";
- if (-e $file) {
- put_in_hash($netc, network::read_resolv_conf($file));
- }
-}
-
-sub get_net_device {
- ${{ getVarsFromSh("/etc/sysconfig/drakconnect") }}{NET_DEVICE};
-}
-
-sub read_net_conf {
- my ($prefix, $netcnx, $netc)=@_;
- add2hash($netcnx, { getVarsFromSh("$prefix/etc/sysconfig/drakconnect") });
- $netc->{$_} = $netcnx->{$_} foreach 'NET_DEVICE', 'NET_INTERFACE';
- $netcnx->{$netcnx->{type}}||={};
- add2hash($netcnx->{$netcnx->{type}}, { getVarsFromSh("$prefix/etc/sysconfig/drakconnect." . $netcnx->{type}) });
-}
-
-sub set_net_conf {
- my ($netcnx, $netc)=@_;
- setVarsInShMode("$prefix/etc/sysconfig/drakconnect", 0600, $netcnx, "NET_DEVICE", "NET_INTERFACE", "type", "PROFILE" );
- setVarsInShMode("$prefix/etc/sysconfig/drakconnect." . $netcnx->{type}, 0600, $netcnx->{$netcnx->{type}}); #- doesn't work, don't know why
- setVarsInShMode("$prefix/etc/sysconfig/drakconnect.netc", 0600, $netc); #- doesn't work, don't know why
-}
-
-sub start_internet {
- my ($o) = @_;
- init_globals ($o, $o->{prefix});
- run_program::rooted($prefix, $connect_file);
-}
-
-sub stop_internet {
- my ($o) = @_;
- init_globals ($o, $o->{prefix});
- run_program::rooted($prefix, $disconnect_file);
-}
-
-#---------------------------------------------
-# WONDERFULL pad
-#---------------------------------------------
-1;
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
deleted file mode 100644
index 60d8ffd41..000000000
--- a/perl-install/network/network.pm
+++ /dev/null
@@ -1,460 +0,0 @@
-package network::network; # $Id$wir
-
-use diagnostics;
-use strict;
-
-#-######################################################################################
-#- misc imports
-#-######################################################################################
-use Socket;
-
-use common;
-use detect_devices;
-use run_program;
-use any;
-use log;
-use vars qw(@ISA @EXPORT);
-
-@ISA = qw(Exporter);
-@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
-#-######################################################################################
-sub read_conf {
- my ($file) = @_;
- my %netc = getVarsFromSh($file);
- \%netc;
-}
-
-sub read_resolv_conf {
- my ($file) = @_;
- my @l = qw(dnsServer dnsServer2 dnsServer3);
- my %netc;
-
- local *F; open F, $file or die "cannot open $file: $!";
- local $_;
- while (<F>) {
- /^\s*nameserver\s+(\S+)/ and $netc{shift @l} = $1;
- }
- \%netc;
-}
-
-sub read_interface_conf {
- my ($file) = @_;
- my %intf = getVarsFromSh($file) or die "cannot open file $file: $!";
-
- $intf{BOOTPROTO} ||= 'static';
- $intf{isPtp} = $intf{NETWORK} eq '255.255.255.255';
- $intf{isUp} = 1;
- \%intf;
-}
-
-sub up_it {
- my ($prefix, $intfs) = @_;
- $_->{isUp} and return foreach values %$intfs;
- my $f = "/etc/resolv.conf"; symlink "$prefix/$f", $f;
- run_program::rooted($prefix, "/etc/rc.d/init.d/network", "start");
- $_->{isUp} = 1 foreach values %$intfs;
-}
-
-sub down_it {
- my ($prefix, $intfs) = @_;
- run_program::rooted($prefix, "/etc/rc.d/init.d/network", "stop");
- $_->{isUp} = 1 foreach values %$intfs;
-}
-
-sub write_conf {
- my ($file, $netc) = @_;
-
- if ($netc->{HOSTNAME}) {
- $netc->{HOSTNAME} =~ /\.(.*)$/;
- $1 and $netc->{DOMAINNAME} = $1;
- }
- ($netc->{DOMAINNAME}) ||= 'localdomain';
- add2hash($netc, {
- NETWORKING => "yes",
- FORWARD_IPV4 => "false",
- HOSTNAME => "localhost.$netc->{DOMAINNAME}",
- });
-
- setVarsInSh($file, $netc, qw(NETWORKING FORWARD_IPV4 DHCP_HOSTNAME HOSTNAME DOMAINNAME GATEWAY GATEWAYDEV NISDOMAIN));
-}
-
-sub write_resolv_conf {
- my ($file, $netc) = @_;
-
- #- get the list of used dns.
- my %used_dns; @used_dns{$netc->{dnsServer}, $netc->{dnsServer2}, $netc->{dnsServer3}} = (1, 2, 3);
-
- unless ($netc->{DOMAINNAME} || $netc->{DOMAINNAME2} || keys %used_dns > 0) {
- unlink($file);
- log::l("neither domain name nor dns server are configured");
- return 0;
- }
-
- my (%search, %dns, @unknown);
- local *F; open F, $file;
- local $_;
-#- my $options;
- while (<F>) {
-#- if (/^[\s]*(options\s+[^#]*).*$/) { $options = $1; $options =~ s/timeout:\d+/timeout:1/; next }
- /^[#\s]*search\s+(.*?)\s*$/ and $search{$1} = $., next;
- /^[#\s]*nameserver\s+(.*?)\s*$/ and $dns{$1} = $., next;
- /^.*# ppp temp entry\s*$/ and next;
- /^[#\s]*(\S.*?)\s*$/ and push @unknown, $1;
- }
-#- $options ||= "options timeout:1";
-
- close F; open F, ">$file" or die "cannot write $file: $!";
- print F "# search $_\n" foreach grep { $_ ne "$netc->{DOMAINNAME} $netc->{DOMAINNAME2}" } sort { $search{$a} <=> $search{$b} } keys %search;
- print F "search $netc->{DOMAINNAME} $netc->{DOMAINNAME2}\n" if ($netc->{DOMAINNAME} || $netc->{DOMAINNAME2});
-#- print F "$options\n\n";
- print F "# nameserver $_\n" foreach grep { ! exists $used_dns{$_} } sort { $dns{$a} <=> $dns{$b} } keys %dns;
- print F "nameserver $_\n" foreach sort { $used_dns{$a} <=> $used_dns{$b} } grep { $_ } keys %used_dns;
- print F "\n";
- print F "# $_\n" foreach @unknown;
- print F "\n";
- print F "# ppp temp entry\n";
-
- #-res_init(); # reinit the resolver so DNS changes take affect
- 1;
-}
-
-sub write_interface_conf {
- my ($file, $intf, $prefix) = @_;
-
- my @ip = split '\.', $intf->{IPADDR};
- my @mask = split '\.', $intf->{NETMASK};
- my $hwaddr;
- $::o->{miscellaneous}{track_network_id} and $hwaddr = -e "$prefix/sbin/ip" && `LC_ALL= LANG= $prefix/sbin/ip -o link show $intf->{DEVICE} 2>/dev/null`;
- if ($hwaddr) { chomp $hwaddr; $hwaddr =~ s/.*link\/ether\s([0-9a-z:]+)\s.*/$1/; }
- $hwaddr and $intf->{HWADDR} = undef;
- add2hash($intf, {
- BROADCAST => join('.', mapn { int $_[0] | ~int $_[1] & 255 } \@ip, \@mask),
- NETWORK => join('.', mapn { int $_[0] & $_[1] } \@ip, \@mask),
- ONBOOT => bool2yesno(!member($intf->{DEVICE}, map { $_->{device} } detect_devices::probeall())),
- if_($::o->{miscellaneous}{track_network_id}, HWADDR => $hwaddr)
- });
- setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR), ($intf->{wireless_eth}) ? qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV) : ());
-}
-
-sub add2hosts {
- my ($file, $hostname, @ips) = @_;
- my %l;
- $l{$_} = $hostname foreach @ips;
-
- local *F;
- if (-e $file) {
- open F, $file or die "cannot open $file: $!";
- /\s*(\S+)(.*)/ and $l{$1} ||= $2 foreach <F>;
- }
- log::l("writing host information to $file");
- open F, ">$file" or die "cannot write $file: $!";
- while (my ($ip, $v) = each %l) {
- $ip or next;
- print F "$ip";
- if ($v =~ /^\s/) {
- print F $v;
- } else {
- print F "\t\t$v";
- print F " $1" if $v =~ /(.*?)\./;
- }
- print F "\n";
- }
-}
-
-# The interface/gateway needs to be configured before this will work!
-sub guessHostname {
- my ($prefix, $netc, $intf) = @_;
-
- $intf->{isUp} && dnsServers($netc) or return 0;
- $netc->{HOSTNAME} && $netc->{DOMAINNAME} and return 1;
-
- write_resolv_conf("$prefix/etc/resolv.conf", $netc);
-
- my $name = gethostbyaddr(Socket::inet_aton($intf->{IPADDR}), AF_INET) or log::l("reverse name lookup failed"), return 0;
-
- log::l("reverse name lookup worked");
-
- add2hash($netc, { HOSTNAME => $name });
- 1;
-}
-
-sub addDefaultRoute {
- my ($netc) = @_;
- c::addDefaultRoute($netc->{GATEWAY}) if $netc->{GATEWAY};
-}
-
-sub sethostname {
- my ($netc) = @_;
- syscall_('sethostname', $netc->{HOSTNAME}, length $netc->{HOSTNAME}) or log::l("sethostname failed: $!");
-}
-
-sub resolv($) {
- my ($name) = @_;
- is_ip($name) and return $name;
- my $a = join(".", unpack "C4", (gethostbyname $name)[4]);
- #-log::l("resolved $name in $a");
- $a;
-}
-
-sub dnsServers {
- my ($netc) = @_;
- my %used_dns; @used_dns{$netc->{dnsServer}, $netc->{dnsServer2}, $netc->{dnsServer3}} = (1, 2, 3);
- sort { $used_dns{$a} <=> $used_dns{$b} } grep { $_ } keys %used_dns;
-}
-
-sub findIntf {
- my ($intf, $device) = @_;
- $intf->{$device}->{DEVICE} = $device;
- $intf->{$device};
-}
-#PAD \s* a la fin
-my $ip_regexp = qr/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
-sub is_ip {
- my ($ip) = @_;
- return 0 unless $ip =~ $ip_regexp;
- my @fields = ($1, $2, $3, $4);
- foreach (@fields) {
- return 0 if $_ < 0 || $_ > 255;
- }
- return 1;
-}
-
-sub netmask {
- my ($ip) = @_;
- return "255.255.255.0" unless is_ip($ip);
- $ip =~ $ip_regexp;
- if ($1 >= 1 && $1 < 127) {
- return "255.0.0.0"; #-1.0.0.0 to 127.0.0.0
- } elsif ($1 >= 128 && $1 <= 191 ){
- return "255.255.0.0"; #-128.0.0.0 to 191.255.0.0
- } elsif ($1 >= 192 && $1 <= 223) {
- return "255.255.255.0";
- } else {
- return "255.255.255.255"; #-experimental classes
- }
-}
-
-sub masked_ip {
- my ($ip) = @_;
- return "" unless is_ip($ip);
- my @mask = netmask($ip) =~ $ip_regexp;
- my @ip = $ip =~ $ip_regexp;
- for (my $i = 0; $i < @ip; $i++) {
- $ip[$i] &= int $mask[$i];
- }
- join(".", @ip);
-}
-
-sub dns {
- my ($ip) = @_;
- my $mask = masked_ip($ip);
- my @masked = masked_ip($ip) =~ $ip_regexp;
- $masked[3] = 2;
- join (".", @masked);
-
-}
-sub gateway {
- my ($ip) = @_;
- my @masked = masked_ip($ip) =~ $ip_regexp;
- $masked[3] = 1;
- join (".", @masked);
-
-}
-
-sub configureNetworkIntf {
- my ($netc, $in, $intf, $net_device, $skip, $module) = @_;
- my $text;
- my @wireless_modules = qw(aironet_cs aironet4500_cs hermes airo orinico_cs orinico airo_cs netwave_cs ray_cs wavelan_cs wvlan_cs airport);
- my $flag = 0;
- foreach (@wireless_modules) {
- $module =~ /$_/ and $flag =1;
- }
- if ($flag) {
- $intf->{wireless_eth} = 1;
- $netc->{wireless_eth} = 1;
- $intf->{WIRELESS_MODE} = "Managed";
- $intf->{WIRELESS_ESSID} = "any";
-#- $intf->{WIRELESS_NWID} = "";
-#- $intf->{WIRELESS_FREQ} = "";
-#- $intf->{WIRELESS_SENS} = "";
-#- $intf->{WIRELESS_RATE} = "";
-#- $intf->{WIRELESS_ENC_KEY} = "";
-#- $intf->{WIRELESS_RTS} = "";
-#- $intf->{WIRELESS_FRAG} = "";
-#- $intf->{WIRELESS_IWCONFIG} = "";
-#- $intf->{WIRELESS_IWSPY} = "";
-#- $intf->{WIRELESS_IWPRIV} = "";
- }
- if ($net_device eq $intf->{DEVICE}) {
- $skip and return 1;
- $text = _("WARNING: this device has been previously configured to connect to the Internet.
-Simply accept to keep this device configured.
-Modifying the fields below will override this configuration.");
- }
- else {
- $text = _("Please enter the IP configuration for this machine.
-Each item should be entered as an IP address in dotted-decimal
-notation (for example, 1.2.3.4).");
- }
- my $pump = $intf->{BOOTPROTO} =~ /^(dhcp|bootp)$/;
- delete $intf->{NETWORK};
- delete $intf->{BROADCAST};
- my $onboot = 1;
- my @fields = qw(IPADDR NETMASK);
- $::isStandalone or $in->set_help('configureNetworkIP');
- $in->ask_from(_("Configuring network device %s", $intf->{DEVICE}),
- (_("Configuring network device %s", $intf->{DEVICE}) . ( $module ? _(" (driver %s)", $module) : '' ) ."\n\n") .
- $text,
- [ { label => _("IP address"), val => \$intf->{IPADDR}, disabled => sub { $pump } },
- { label => _("Netmask"), val => \$intf->{NETMASK}, disabled => sub { $pump } },
- { label => _("Automatic IP"), val => \$pump, type => "bool", text => _("(bootp/dhcp)") },
- if_($::expert, { label => _("Start at boot"), val => \$onboot, type => "bool" }),
- if_($intf->{wireless_eth},
- { label => "WIRELESS_MODE", val => \$intf->{WIRELESS_MODE}, list => [ "Ad-hoc", "Managed", "Master", "Repeater", "Secondary", "Auto"] },
- { label => "WIRELESS_ESSID", val => \$intf->{WIRELESS_ESSID} },
- { label => "WIRELESS_NWID", val => \$intf->{WIRELESS_NWID} },
- { label => "WIRELESS_FREQ", val => \$intf->{WIRELESS_FREQ} },
- { label => "WIRELESS_SENS", val => \$intf->{WIRELESS_SENS} },
- { label => "WIRELESS_RATE", val => \$intf->{WIRELESS_RATE} },
- { label => "WIRELESS_ENC_KEY", val => \$intf->{WIRELESS_ENC_KEY} },
- { label => "WIRELESS_RTS", val => \$intf->{WIRELESS_RTS} },
- { label => "WIRELESS_FRAG", val => \$intf->{WIRELESS_FRAG} },
- { label => "WIRELESS_IWCONFIG", val => \$intf->{WIRELESS_IWCONFIG} },
- { label => "WIRELESS_IWSPY", val => \$intf->{WIRELESS_IWSPY} },
- { label => "WIRELESS_IWPRIV", val => \$intf->{WIRELESS_IWPRIV} }
- ),
- ],
- complete => sub {
- $intf->{BOOTPROTO} = $pump ? "dhcp" : "static";
- return 0 if $pump;
- for (my $i = 0; $i < @fields; $i++) {
- unless (is_ip($intf->{$fields[$i]})) {
- $in->ask_warn('', _("IP address should be in format 1.2.3.4"));
- return (1,$i);
- }
- return 0;
- }
- if ($intf->{WIRELESS_FREQ} !~ /[0-9.]*[kGM]/) {
- $in->ask_warn('', _('Freq should have the suffix k, M or G (for example, "2.46G" for 2.46 GHz frequency), or add enough \'0\'.'));
- return (1,6);
- }
- if ($intf->{WIRELESS_RATE} !~ /[0-9.]*[kGM]/) {
- $in->ask_warn('', _('Rate should have the suffix k, M or G (for example, "11M" for 11M), or add enough \'0\'.'));
- return (1,8);
- }
- },
- focus_out => sub {
- $intf->{NETMASK} ||= netmask($intf->{IPADDR}) unless $_[0]
- }
- );
- $intf->{ONBOOT} = bool2yesno($onboot);
-}
-
-sub configureNetworkNet {
- my ($in, $netc, $intf, @devices) = @_;
-
- $netc->{dnsServer} ||= dns($intf->{IPADDR});
- my $gateway_ex = gateway($intf->{IPADDR});
-#- $netc->{GATEWAY} ||= gateway($intf->{IPADDR});
-
- $::isInstall and $in->set_help('configureNetworkHost');
- $in->ask_from(_("Configuring network"),
-_("Please enter your host name.
-Your host name should be a fully-qualified host name,
-such as ``mybox.mylab.myco.com''.
-You may also enter the IP address of the gateway if you have one"),
- [ { label => _("Host name"), val => \$netc->{HOSTNAME} },
- { label => _("DNS server"), val => \$netc->{dnsServer} },
- { label => _("Gateway (e.g. %s)", $gateway_ex), val => \$netc->{GATEWAY} },
- if_(@devices > 1,
- { label => _("Gateway device"), val => \$netc->{GATEWAYDEV}, list => \@devices },
- ),
- ],
- );
-}
-
-sub miscellaneousNetwork {
- my ($in, $clicked, $no_track_net) = @_;
- my $u = $::o->{miscellaneous} ||= {};
- $::isInstall and $in->set_help('configureNetworkProxy');
- $u->{track_network_id} = detect_devices::isLaptop();
- $::expert || $clicked and $in->ask_from('',
- _("Proxies configuration"),
- [ { label => _("HTTP proxy"), val => \$u->{http_proxy} },
- { label => _("FTP proxy"), val => \$u->{ftp_proxy} },
- if_(!$no_track_net, { label => _("Track network card id (useful for laptops)"), val => \$u->{track_network_id}, type => "bool" }),
- ],
- complete => sub {
- $u->{http_proxy} =~ m,^($|http://), or $in->ask_warn('', _("Proxy should be http://...")), return 1,0;
- $u->{ftp_proxy} =~ m,^($|ftp://), or $in->ask_warn('', _("Proxy should be ftp://...")), return 1,1;
- 0;
- }
- ) || return;
-}
-
-sub read_all_conf {
- my ($prefix, $netc, $intf) = @_;
- $netc ||= {}; $intf ||= {};
- add2hash($netc, read_conf("$prefix/etc/sysconfig/network")) if -r "$prefix/etc/sysconfig/network";
- add2hash($netc, read_resolv_conf("$prefix/etc/resolv.conf")) if -r "$prefix/etc/resolv.conf";
- foreach (all("$prefix/etc/sysconfig/network-scripts")) {
- if (/ifcfg-(\w+)/ && $1 ne 'lo' && $1 !~ /ppp/) {
- my $intf = findIntf($intf, $1);
- add2hash($intf, { getVarsFromSh("$prefix/etc/sysconfig/network-scripts/$_") });
- }
- }
-}
-
-#- configureNetwork2 : configure the network interfaces.
-#- input
-#- $prefix
-#- $netc
-#- $intf
-#- $netc input
-#- NETWORKING : networking flag : string : "yes" by default
-#- FORWARD_IPV4 : forward IP flag : string : "false" by default
-#- HOSTNAME : hostname : string : "localhost.localdomain" by default
-#- DOMAINNAME : domainname : string : $netc->{HOSTNAME} =~ /\.(.*)/ by default
-#- DOMAINNAME2 : well it's another domainname : have to look further why we used 2
-#- The following are facultatives
-#- DHCP_HOSTNAME : If you have a dhcp and want to set the hostname
-#- GATEWAY : gateway
-#- GATEWAYDEV : gateway interface
-#- NISDOMAIN : nis domain
-#- $netc->{dnsServer} : dns server 1
-#- $netc->{dnsServer2} : dns server 2
-#- $netc->{dnsServer3} : dns server 3 : note that we uses the dns1 for the LAN, and the 2 others for the internet conx
-#- $intf input: for each $device (for example ethx)
-#- $intf->{$device}{IPADDR} : IP address
-#- $intf->{$device}{NETMASK} : netmask
-#- $intf->{$device}{DEVICE} : DEVICE = $device
-#- $intf->{$device}{BOOTPROTO} : boot prototype : "bootp" or "dhcp" or "pump" or ...
-sub configureNetwork2 {
- my ($in, $prefix, $netc, $intf) = @_;
- my $etc = "$prefix/etc";
-
- $netc->{wireless_eth} and $in->do_pkgs->install(qw(wireless-tools));
- write_conf("$etc/sysconfig/network", $netc);
- write_resolv_conf("$etc/resolv.conf", $netc);
- write_interface_conf("$etc/sysconfig/network-scripts/ifcfg-$_->{DEVICE}", $_, $prefix) foreach grep { $_->{DEVICE} } values %$intf;
- add2hosts("$etc/hosts", $netc->{HOSTNAME}, map { $_->{IPADDR} } values %$intf);
-
- if (grep { $_->{BOOTPROTO} =~ /^(dhcp)$/ } values %$intf) {
- $in->do_pkgs->install($netc->{dhcp_client} ? $netc->{dhcp_client} : 'dhcpcd');
- }
- if (grep { $_->{BOOTPROTO} =~ /^(pump|bootp)$/ } values %$intf) {
- $in->do_pkgs->install('pump');
- }
- #-res_init(); #- reinit the resolver so DNS changes take affect
-
- any::miscellaneousNetwork($prefix);
-}
-
-
-#-######################################################################################
-#- Wonderful perl :(
-#-######################################################################################
-1;
diff --git a/perl-install/network/nfs.pm b/perl-install/network/nfs.pm
deleted file mode 100644
index 58b2dab28..000000000
--- a/perl-install/network/nfs.pm
+++ /dev/null
@@ -1,66 +0,0 @@
-package network::nfs; # $Id$
-
-use strict;
-use diagnostics;
-
-use common;
-use network::network;
-use network::smbnfs;
-use log;
-
-our @ISA = 'network::smbnfs';
-
-sub to_fstab_entry {
- my ($class, $e) = @_;
- $class->to_fstab_entry_raw($e, 'nfs');
-}
-sub comment_to_string {
- my ($class, $comment) = @_;
- member($comment, qw(* 0.0.0.0/0.0.0.0 (everyone))) ? '' : $comment;
-}
-sub from_dev {
- my ($class, $dev) = @_;
- $dev =~ m|(.*?):(.*)|;
-}
-sub to_dev_raw {
- my ($class, $server, $name) = @_;
- $server . ':' . $name;
-}
-
-sub check {
- my ($class, $in) = @_;
- $class->raw_check($in, 'nfs-utils-clients', '/usr/sbin/showmount');
-}
-
-sub find_servers {
- local *F;
- my $pid = open F, "rpcinfo-flushed -b mountd 2 |";
- $SIG{ALRM} = sub { kill(15, $pid) };
- alarm 1;
-
- my $domain = chomp_(`domainname`);
- my @servers;
- while (<F>) {
- chomp;
- my ($ip, $name) = /(\S+)\s+(\S+)/ or log::l("bad line in rpcinfo output"), next;
- $name =~ s/\Q.$domain//;
- $name =~ s/\.$//;
- push @servers, { ip => $ip, if_($name ne '(unknown)', name => $name) };
- }
- @servers;
-}
-
-sub find_exports {
- my ($class, $server) = @_;
-
- local *F;
- my $s = $server->{ip} || $server->{name};
- my $pid = open F, "showmount -e $s |";
- $SIG{ALRM} = sub { kill(15, $pid) };
- alarm 5;
-
- my (undef, @l) = <F>;
- map { /(\S+)\s*(\S+)/; { name => $1, comment => $2, server => $server } } @l;
-}
-
-1;
diff --git a/perl-install/network/smb.pm b/perl-install/network/smb.pm
deleted file mode 100644
index d212f5122..000000000
--- a/perl-install/network/smb.pm
+++ /dev/null
@@ -1,150 +0,0 @@
-package network::smb; # $Id$
-
-use strict;
-use diagnostics;
-
-use common;
-use fs;
-use network::network;
-use network::smbnfs;
-
-
-our @ISA = 'network::smbnfs';
-
-sub to_fstab_entry {
- my ($class, $e) = @_;
- my $part = $class->to_fstab_entry_raw($e, 'smbfs');
- if ($e->{server}{username}) {
- my ($options, $unknown) = fs::mount_options_unpack($part);
- $options->{"$_="} = $e->{server}{$_} foreach qw(username password domain);
- fs::mount_options_pack($part, $options, $unknown);
- }
- $part;
-}
-sub from_dev {
- my ($class, $dev) = @_;
- $dev =~ m|//(.*?)/(.*)|;
-}
-sub to_dev_raw {
- my ($class, $server, $name) = @_;
- '//' . $server . '/' . $name;
-}
-
-sub check {
- my ($class, $in) = @_;
- $class->raw_check($in, 'samba-client', '/usr/bin/nmblookup');
-}
-
-sub smbclient {
- my ($server) = @_;
- my $name = $server->{name} || $server->{ip};
- my $ip = $server->{ip} ? "-I $server->{ip}" : '';
- my $group = $server->{group} ? " -W $server->{group}" : '';
-
- my $U = $server->{username} ? "$server->{domain}/$server->{username}%$server->{password}" : '%';
- `smbclient -U $U -L $name $ip$group`;
-}
-
-sub find_servers {
- my (undef, @l) = `nmblookup "*"`;
- s/\s.*\n// foreach @l;
- my @servers = grep { network::network::is_ip($_) } @l;
- my %servers;
- $servers{$_}{ip} = $_ foreach @servers;
- my ($ip, $browse);
- foreach (`nmblookup -A @servers`) {
- my $nb = /^Looking up status of (\S+)/ .. /^$/ or next;
- if ($nb == 1) {
- $ip = $1;
- } elsif (/<00>/) {
- $servers{$ip}{/<GROUP>/ ? 'group' : 'name'} ||= lc first(/(\S+)/);
- } elsif (/__MSBROWSE__/) {
- $browse ||= $servers{$ip};
- }
- }
- if ($browse) {
- my %l;
- foreach (smbclient($browse)) {
- my $nb = /^\s*Workgroup/ .. /^$/;
- $nb > 2 or next;
- my ($group, $name) = split(' ', lc($_));
-
- # already done
- next if grep { $group eq $_->{group} } values %servers;
-
- $l{$name} = $group;
- }
- if (my @l = keys %l) {
- foreach (`nmblookup @l`) {
- $servers{$1} = { name => $2, group => $l{$2} } if /(\S+)\s+([^<]+)<00>/;
- }
- }
- }
- values %servers;
-}
-
-sub find_exports {
- my ($class, $server) = @_;
- my @l;
-
- foreach (smbclient($server)) {
- chomp;
- s/^\t//;
- /NT_STATUS_/ and die $_;
- my ($name, $type, $comment) = unpack "A15 A10 A*", $_;
- if ($name eq '---------' && $type eq '----' && $comment eq '-------' .. /^$/) {
- push @l, { name => $name, type => $type, comment => $comment, server => $server }
- if $type eq 'Disk' && $name !~ /\$$/ && $name !~ /NETLOGON|SYSVOL/;
- }
- }
- @l;
-}
-
-sub authentifications_available {
- my ($server) = @_;
- map { if_(/^auth.\Q$server->{name}.\E(.*)/, $1) } all("/etc/samba");
-}
-
-sub to_credentials {
- my ($server_name, $username) = @_;
- $username or die 'to_credentials';
- "/etc/samba/auth.$server_name.$username";
-}
-
-sub fstab_entry_to_credentials {
- my ($part) = @_;
-
- my ($server_name) = network::smb->from_dev($part->{device}) or return;
-
- my ($options, $unknown) = fs::mount_options_unpack($part);
- $options->{'username='} && $options->{'password='} or return;
- my %h = map { $_ => delete $options->{"$_="} } qw(username domain password);
- $h{file} = $options->{'credentials='} = to_credentials($server_name, $h{username});
- fs::mount_options_pack_($part, $options, $unknown), \%h;
-}
-
-sub remove_bad_credentials {
- my ($server) = @_;
- unlink to_credentials($server->{name}, $server->{username});
-}
-
-sub save_credentials {
- my ($credentials) = @_;
- my $file = $credentials->{file};
- output($file, map { "$_ = $credentials->{$_}\n" } qw(username domain password));
- chmod(0640, $file);
-}
-
-
-sub read_credentials_raw {
- my ($file) = @_;
- my %h = map { /(.*?)\s*=\s*(.*)/ } cat_($file);
- \%h;
-}
-
-sub read_credentials {
- my ($server, $username) = @_;
- put_in_hash($server, read_credentials_raw(to_credentials($server->{name}, $username)));
-}
-
-1;
diff --git a/perl-install/network/smbnfs.pm b/perl-install/network/smbnfs.pm
deleted file mode 100644
index 6b55f6fd0..000000000
--- a/perl-install/network/smbnfs.pm
+++ /dev/null
@@ -1,58 +0,0 @@
-package network::smbnfs; # $Id$
-
-use strict;
-use diagnostics;
-
-use fs;
-
-
-sub new {
- my ($class, $v) = @_;
- bless($v || {}, $class);
-}
-
-sub server_to_string {
- my ($class, $server) = @_;
- $server->{name} || $server->{ip};
-}
-sub comment_to_string {
- my ($class, $comment) = @_;
- $comment;
-}
-sub to_dev {
- my ($class, $e) = @_;
- $class->to_dev_raw($class->server_to_string($e->{server}), $e->{name} || $e->{ip});
-}
-sub to_string {
- my ($class, $e) = @_;
- my $comment = $class->comment_to_string($e->{comment});
- ($e->{name} || $e->{ip}) . ($comment ? " ($comment)" : '');
-}
-
-sub to_fullstring {
- my ($class, $e) = @_;
- my $comment = $class->comment_to_string($e->{comment});
- $class->to_dev($e) . ($comment ? " ($comment)" : '');
-}
-sub to_fstab_entry_raw {
- my ($class, $e, $type) = @_;
- my $fs_entry = { device => $class->to_dev($e), type => $type };
- fs::set_default_options($fs_entry);
- $fs_entry;
-}
-
-sub raw_check {
- my ($class, $in, $pkg, $file) = @_;
- if (! -e $file) {
- $in->ask_okcancel('', _("The package %s needs to be installed. Do you want to install it?", $pkg), 1) or return;
- $in->do_pkgs->install($pkg);
- }
- if (! -e $file) {
- $in->ask_warn('', _("Mandatory package %s is missing", $pkg));
- return;
- }
- 1;
-}
-
-1;
-
diff --git a/perl-install/network/tools.pm b/perl-install/network/tools.pm
deleted file mode 100644
index f155f359d..000000000
--- a/perl-install/network/tools.pm
+++ /dev/null
@@ -1,227 +0,0 @@
-package network::tools;
-
-use common;
-use run_program;
-use c;
-use vars qw(@ISA @EXPORT);
-use MDK::Common::Globals "network", qw($in $prefix $disconnect_file $connect_prog $connect_file);
-use MDK::Common::System qw(getVarsFromSh);
-
-@ISA = qw(Exporter);
-@EXPORT = qw(write_cnx_script write_secret_backend write_initscript ask_connect_now connect_backend disconnect_backend read_providers_backend ask_info2 type2interface connected connected_bg connected2 disconnected);
-@EXPORT_OK = qw($in);
-
-sub write_cnx_script {
- my ($netc, $type, $up, $down, $type2) = @_;
- if ($type) {
- $netc->{internet_cnx}{$type}{$_->[0]}=$_->[1] foreach ([$connect_file, $up], [$disconnect_file, $down]);
- $netc->{internet_cnx}{$type}{type} = $type2;
- } else {
- foreach ($connect_file, $disconnect_file) {
- output ("$prefix$_",
-'#!/bin/bash
-' . if_(!$netc->{at_boot}, 'if [ "x$1" == "x--boot_time" ]; then exit; fi
-') . $netc->{internet_cnx}{$netc->{internet_cnx_choice}}{$_});
- chmod 0755, "$prefix" . $_;
- }
- }
-}
-
-sub write_secret_backend {
- my ($a, $b) = @_;
- foreach my $i ("pap-secrets", "chap-secrets") {
- substInFile { s/^'$a'.*\n//; $_ .= "\n'$a' * '$b' * \n" if eof } "$prefix/etc/ppp/$i";
- }
-}
-
-sub ask_connect_now {
- my ($type) = @_;
- $::Wizard_no_previous=1;
- #- FIXME : code the exception to be generated by ask_yesorno, to be able to remove the $::Wizard_no_previous=1;
- if ($in->ask_yesorno(_("Internet configuration"),
- _("Do you want to try to connect to the Internet now?")
- )) {
- my $up;
- {
- my $w = $in->wait_message('', _("Testing your connection..."), 1);
- connect_backend();
- my $s = 30;
- $type =~ /modem/ and $s=50;
- $type =~ /adsl/ and $s=35;
- $type =~ /isdn/ and $s=20;
- sleep $s;
- my $netc = {};
- $up=connected();
- }
- my $m = $up ? (_("The system is now connected to Internet.") .
- if_($::isInstall, _("For security reason, it will be disconnected now.")) ) :
- _("The system doesn't seem to be connected to internet.
-Try to reconfigure your connection.");
- if ($::isWizard) {
- $::Wizard_no_previous=1;
- $::Wizard_finished=1;
- $in->ask_okcancel(_("Network Configuration"), $m, 1);
- undef $::Wizard_no_previous;
- undef $::Wizard_finished;
- } else { $in->ask_warn('', $m ); }
- $::isInstall and disconnect_backend();
- }
- undef $::Wizard_no_previous;
- $up;
-}
-
-sub connect_backend { run_program::rooted($prefix, "$connect_prog &") }
-
-sub disconnect_backend { run_program::rooted($prefix, "$disconnect_file &") }
-
-sub read_providers_backend { my ($file) = @_; map { /(.*?)=>/ } catMaybeCompressed($file) }
-
-sub ask_info2 {
- my ($cnx, $netc) = @_;
- $::isInstall and $in->set_help('configureNetworkDNS');
- $in->ask_from(_("Connection Configuration"),
- _("Please fill or check the field below"),
- [
- if__($cnx->{irq}, { label => _("Card IRQ"), val => \$cnx->{irq} }) ,
- if__($cnx->{mem}, { label => _("Card mem (DMA)"), val => \$cnx->{mem} }),
- if__($cnx->{io}, { label => _("Card IO"), val => \$cnx->{io} }),
- if__($cnx->{io0}, { label => _("Card IO_0"), val => \$cnx->{io0} }),
- if__($cnx->{io1}, { label => _("Card IO_1"), val => \$cnx->{io1} }),
- if__($cnx->{phone_in}, { label => _("Your personal phone number"), val => \$cnx->{phone_in} }),
- if__($netc->{DOMAINNAME2}, { label => _("Provider name (ex provider.net)"), val => \$netc->{DOMAINNAME2} }),
- if__($cnx->{phone_out}, { label => _("Provider phone number"), val => \$cnx->{phone_out} }),
- if__($netc->{dnsServer2}, { label => _("Provider dns 1 (optional)"), val => \$netc->{dnsServer2} }),
- if__($netc->{dnsServer3}, { label => _("Provider dns 2 (optional)"), val => \$netc->{dnsServer3} }),
- if__($cnx->{vpivci}, { label => _("Choose your country"), val => \$netc->{vpivci}, list => detect_timezone() }),
- if__($cnx->{dialing_mode}, { label => _("Dialing mode"), val => \$cnx->{dialing_mode},list=>["auto","manual"]}),
- if__($cnx->{speed}, { label => _("Connection speed"), val => \$cnx->{speed}, list => ["64 Kb/s", "128 Kb/s"]}),
- if__($cnx->{huptimeout}, { label => _("Connection timeout (in sec)"), val => \$cnx->{huptimeout} }),
- if__($cnx->{login}, { label => _("Account Login (user name)"), val => \$cnx->{login} }),
- if__($cnx->{passwd}, { label => _("Account Password"), val => \$cnx->{passwd}, hidden => 1 }),
- ]
- ) or return;
- if ($netc->{vpivci}) {
- foreach (['Netherlands', '8_48'], ['France', '8_35'], ['Belgium', '8_35'], ['Italy', '8_35'], ['UK', '0_38'], ['USA', '8_35']) {
- $netc->{vpivci} eq $_->[0] and $netc->{vpivci} = $_->[1];
- }
- }
- 1;
-}
-
-sub detect_timezone {
- my %tmz2country = (
- 'Europe/Paris' => _("France"),
- 'Europe/Amsterdam' => _("Netherlands"),
- 'Europe/Rome' => _("Italy"),
- 'Europe/Brussels' => _("Belgium"),
- 'America/New_York' => _("United States"),
- 'Europe/London' => _("United Kingdom")
- );
- my %tm_parse = MDK::Common::System::getVarsFromSh('/etc/sysconfig/clock');
- foreach (keys %tmz2country) {
- if ($_ eq $tm_parse{ZONE}) {
- unshift @country, $tmz2country{$_};
- } else { push @country, $tmz2country{$_} };
- }
- \@country;
-}
-
-sub type2interface {
- my ($i) = @_;
- $i=~/$_->[0]/ and return $_->[1] foreach (
- [ modem => 'ppp'],
- [ isdn_internal => 'ippp'],
- [ isdn_external => 'ppp'],
- [ adsl => 'ppp'],
- [ cable => 'eth'],
- [ lan => 'eth']);
-}
-
-sub connected { gethostbyname("mandrakesoft.com") ? 1 : 0 }
-
-my $kid_pipe;
-sub connected_bg {
- local $|=1;
- my ($ref) = @_;
- if (defined $kid_pipe) {
- local *F;
- *F = *$kid_pipe;
- fcntl(F, c::F_SETFL(), c::O_NONBLOCK()) or die "can't fcntl F_SETFL: $!";
- my $a;
- if (defined($a = <F>)) {
- close($kid_pipe) || warn "kid exited $?";
- undef $kid_pipe;
- $$ref = $a;
- }
- } else { $kid_pipe = connected2(); }
- 1;
-}
-
-sub connected2 {
- my $pid = open(KID_TO_READ, "-|");
- if ($pid) { # parent
- return \*KID_TO_READ;
- } else { # child
- my $a = gethostbyname("mandrakesoft.com") ? 1 : 0;
- print $a;
- c::_exit(0);
- }
-}
-
-sub disconnected { }
-
-
-sub write_initscript {
- output ("$prefix/etc/rc.d/init.d/internet",
- q{
-#!/bin/bash
-#
-# internet Bring up/down internet connection
-#
-# chkconfig: 2345 11 89
-# description: Activates/Deactivates the internet interfaces
-#
-# dam's (damien@mandrakesoft.com)
-
-# Source function library.
-. /etc/rc.d/init.d/functions
-
- case "$1" in
- start)
- if [ -e } . $connect_file . q{ ]; then
- action "Checking internet connections to start at boot" "} . "$connect_file --boot_time" . q{"
- else
- action "No connection to start" "true"
- fi
- touch /var/lock/subsys/internet
- ;;
- stop)
- if [ -e } . $disconnect_file . q{ ]; then
- action "Stopping internet connection if needed: " "} . "$disconnect_file --boot_time" . q{"
- else
- action "No connection to stop" "true"
- fi
- rm -f /var/lock/subsys/internet
- ;;
- restart)
- $0 stop
- echo "Waiting 10 sec before restarting the internet connection."
- sleep 10
- $0 start
- ;;
- status)
- ;;
- *)
- echo "Usage: internet {start|stop|status|restart}"
- exit 1
-esac
-exit 0
- });
- chmod 0755, "$prefix/etc/rc.d/init.d/internet";
- $::isStandalone ? system("/sbin/chkconfig --add internet") : do {
- symlinkf ("../init.d/internet", "$prefix/etc/rc.d/rc$_") foreach
- '0.d/K11internet', '1.d/K11internet', '2.d/K11internet', '3.d/S89internet', '5.d/S89internet', '6.d/K11internet';
- };
-}
-
-1;