summaryrefslogtreecommitdiffstats
path: root/perl-install/network/netconnect.pm
blob: b02c5b05e547755a369afeab55e23ab4d889fecc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
package network::netconnect;

use common;
use log;
use detect_devices;
use run_program;
use modules;
use any;
use mouse;
use network;
use Data::Dumper;
use network::tools;
use MDK::Common::Globals "network", qw($in $prefix $connect_file $disconnect_file $connect_prog);

my	%conf;
#- 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 = N("You are currently connected to internet.") . (-e $disconnect_file ? N("\nYou can disconnect or reconfigure your connection.") : N("\nYou can reconfigure your connection."));
	    $connected = 1;
	} else {
	    $text = N("You are not currently connected to Internet.") . (-e $connect_file ? N("\nYou can connect to Internet or reconfigure your connection.") : N("\nYou can reconfigure your connection."));
	    $connected = 0;
	}
	my @l = (
	       if_(!$connected && -e $connect_file, { description => N("Connect"), c => 1 }),
	       if_($connected && -e $disconnect_file, { description => N("Disconnect"), c => 2 }),
	       { description => N("Configure the connection"), c => 3 },
	       { description => N("Cancel"), c => 4 },
	      );
	my $e = $in->ask_from_listf(N("Internet connection & configuration"),
				    translate($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);
    map { $auto_detect->{lan}{$_->[0]} = $_->[1] } @all_cards if !$net_install;

    my $adsl = {};
    require network::adsl;
    network::adsl->import;
    $auto_detect->{adsl} = adsl_detect($adsl);

    require network::modem;
    network::modem->import;
    my ($modem, @pci_modems) = detect_devices::getModem();
    $modem->{device} and $auto_detect->{modem} = $modem->{device};
    @pci_modems and $auto_detect->{winmodem}{$_->{driver}} = $_->{description} foreach @pci_modems;
}

sub pre_func {
    my ($text) = @_;
    $in->isa('interactive_gtk') or return;
    $::Wizard_no_previous = 1;
    if ($::isStandalone) {
	$::Wizard_splash = 1;
	require ugtk2;
	ugtk2->import(qw(:wrappers));
	my $W = ugtk2->new(N("Network Configuration Wizard"));
	gtkadd($W->{window},
	       gtkpack_(new Gtk2::VBox(0, 0),
			1, write_on_pixmap(gtkcreate_img("drakconnect_step"),
					   20,200,
					   N("We are now going to configure the %s connection.", translate($text)),
					  ),
			0, $W->create_okcancel(N("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(N("Network Configuration Wizard"), N("\n\n\nWe are now going to configure the %s connection.\n\n\nPress OK to continue.", translate($_[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::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(N("Network Configuration"),
						      N("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_with_perm("$prefix$connect_file", 0755,
      qq(
ifup eth0
));
    output("$prefix$disconnect_file", 0755,
      qq(
ifdown eth0
));
    $direct_net_install = 1;
    goto step_5;
};
    }

    $netc->{autodetection} = 1;
    $netc->{autodetect} = {};

  step_1:
    $::Wizard_no_previous = 1;
    my @profiles = get_profiles();
    eval { $in->ask_from(N("Network Configuration Wizard"),
			 N("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 => N("Choose the profile to configure"), val => \$netcnx->{PROFILE}, list => \@profiles }),
			  { label => N("Use auto detection"), val => \$netc->{autodetection}, type => 'bool' },
			  if_($::isStandalone, { label => N("Expert Mode"), val => \$::expert, type => 'bool' }),
			 ]
			) or goto step_5; }; $in->exit(0) if $@ =~ /wizcancel/;
    undef $::Wizard_no_previous;
    set_profile($netcnx);
    if ($netc->{autodetection}) {
	my $_w = $in->wait_message(N("Network Configuration Wizard"), N("Detecting devices..."));
	detect($netc->{autodetect}, $::isInstall && ($in->{method} eq "ftp" || $in->{method} eq "http" || $in->{method} eq "nfs"));
    }

  step_2:
    $conf{$_} = $netc->{autodetect}{$_} ? 1 : 0 foreach 'modem', 'winmodem', 'adsl', 'cable', 'lan';
    $conf{isdn} = $netc->{autodetect}{isdn}{description} ? 1 : 0;

    $::isInstall and $in->set_help('configureNetwork');
    my @l = (
	  [N("Normal modem connection") . if_($netc->{autodetect}{modem}, " - " . N("detected on port %s", $netc->{autodetect}{modem})), \$conf{modem}],
	  [N("Winmodem connection") . if_($netc->{autodetect}{winmodem}, " - " . N("detected")), \$conf{winmodem}],
	  [N("ISDN connection") . if_($netc->{autodetect}{isdn}{description}, " - " . N("detected %s", $netc->{autodetect}{isdn}{description})), \$conf{isdn}],
	  [N("ADSL connection") . if_($netc->{autodetect}{adsl}, " - " . N("detected")), \$conf{adsl}],
	  [N("Cable connection") . if_($netc->{autodetect}{cable}, " - " . N("cable connection detected")), \$conf{cable}],
	  [N("LAN connection") . if_($netc->{autodetect}{lan}, " - " . N("ethernet card(s) detected")), \$conf{lan}]
	 );
    $::isInstall and $in->set_help('configureNetwork');
    eval { $in->ask_from(N("Network Configuration Wizard"), N("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($in, $netcnx, $mouse, $netc, $intf) or goto step_2 };
	   $conf{winmodem} and do { pre_func("winmodem"); require network::modem; network::modem::winmodemConfigure($in, $netc) or goto step_2 }; 
	   $conf{isdn} and do { pre_func("isdn"); require network::isdn; network::isdn::configure($netcnx, $netc, $isdn) 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 };
       }; $in->exit(0) if $@ =~ /wizcancel/;
  
  step_2_1:
    my $nb = keys %{$netc->{internet_cnx}};
    if ($nb < 1) {
    } elsif ($nb > 1) {
	eval { $in->ask_from(N("Network Configuration Wizard"),
			     N("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 => N("Internet connection"), val => \$netc->{internet_cnx_choice}, list => [ keys %{$netc->{internet_cnx}} ] } ]
			    ) or goto step_2; }; $in->exit(0) if $@ =~ /wizcancel/;
    } 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(N("Network Configuration Wizard"), N("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;
    
    eval { if ($netconnect::need_restart_network && $::isStandalone and ($::expert or $in->ask_yesorno(N("Network configuration"),
												       N("The network needs to be restarted"), 1) or goto step_2)) {
	if (!run_program::rooted($prefix, "/etc/rc.d/init.d/network restart")) {
	    $success = 0;
	    $in->ask_okcancel(N("Network Configuration"), 
			      N("A problem occured while restarting the network: \n\n%s", `/etc/rc.d/init.d/network restart`), 0);
	}
    }
       }; $in->exit(0) if $@ =~ /wizcancel/;

    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 ? N("Congratulations, the network and Internet configuration is finished.
The configuration will now be applied to your system.

") . if_($::isStandalone && $in->isa('interactive_gtk'),
N("After this is done, we recommend that you restart your X environment to avoid any hostname-related problems.")) : 
      N("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;
	eval { $in->ask_okcancel(N("Network Configuration"), $m, 1); }; $in->exit(0) if $@ =~ /wizcancel/;
	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);

    my $connect_cmd;
    if ($netcnx->{type} =~ /modem/ || $netcnx->{type} =~ /isdn_external/) {
	$connect_cmd = 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}) {
	$connect_cmd = qq(
#!/bin/bash
if [ -n "\$DISPLAY" ]; then
/usr/sbin/net_monitor --connect
else
$connect_file
fi
);
    } else {
	$connect_cmd = qq(
#!/bin/bash
/usr/sbin/drakconnect
);
    }
    if ($direct_net_install) {
	$connect_cmd = qq(
#!/bin/bash
if [ -n "\$DISPLAY" ]; then
/usr/sbin/net_monitor --connect
else
$connect_file
fi
);
    }
    output_with_perm("$prefix$connect_prog", 0755, $connect_cmd) if $connect_cmd;
    $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 ($::isInstall && $::o->{security} >= 3) {
	require network::drakfirewall;
	network::drakfirewall::main($in, $::o->{security} <= 3);
    }
}

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 };
    my $str;
    $str .= "
PPPDevice=$modem->{device}
PPPDeviceSpeed=
PPPConnectionName=$modem->{connection}
PPPProviderDomain=$modem->{domain}
PPPLogin=$modem->{login}
PPPAuthentication=$modem->{auth}
PPPSpecialCommand=" . ($netcnx->{type} eq 'isdn_external' ? $netcnx->{isdn_external}{special_command} : '') if $conf{modem};

    $str .= "
ADSLInterfacesList=
ADSLModem=" .  q( # Obsolete information. Please don't use it.) . "
ADSLType=" . ($netcnx->{type} =~ /adsl/ ? $netcnx->{type} : '') . "
ADSLProviderDomain=$netc->{DOMAINNAME2}
ADSLLogin=$adsl->{login}
" . #ADSLPassword=$adsl->{passwd}
"DOMAINNAME2=$netc->{DOMAINNAME2}" if $conf{adsl};

    output_with_perm("$prefix/etc/sysconfig/network-scripts/drakconnect_conf", 0600, $str);
    my $a = $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"],
	      ["$prefix/etc/ppp/peers/adsl", "eci"],
	    ) {
	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"],
	      ["$prefix/etc/ppp/peers/adsl", "eci"],
	    ) {
	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} || "default");
    my $cmd2 = "$prefix/etc/sysconfig/network-scripts/drakconnect_conf." . $profile;
    cp_af($cmd1, $cmd2);
}

sub get_profiles {
    map { if_(/drakconnect_conf\.(.*)/, $1) } all("$::prefix/etc/sysconfig/network-scripts");
}

sub load_conf {
    my ($netcnx, $netc, $intf) = @_;
    my $adsl_pptp = {};
    my $adsl_pppoe = {};
    my $modem = {};
    my $isdn_external = {};
    my $isdn = {};

    if (-e "$prefix/etc/sysconfig/network-scripts/drakconnect_conf") {
	foreach (cat_("$prefix/etc/sysconfig/network-scripts/drakconnect_conf")) {

	    /^PPPConnectionName=(.*)$/ and $modem->{connection} = $1; # Keep this for futur multiple cnx support
	    /^PPPProviderDomain=(.*)$/ and $modem->{domain} = $1; # used only for kppp
	    /^PPPLogin=(.*)$/ and $modem->{login} = $1;
	    /^PPPAuthentication=(.*)$/ and $modem->{auth} = $1; # We keep this because system is configured the same for both PAP and CHAP.
	    
	    if (/^PPPSpecialCommand=(.*)$/) {
		$netcnx->{type} eq 'isdn_external' and $netcnx->{$netcnx->{type}}{special_command} = $1;
	    }

	    /^DOMAINNAME2=(.*)$/ and $netc->{DOMAINNAME2} = $1;
	}
    }

    $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;

    network::read_all_conf($prefix, $netc, $intf);
}

#- ensures the migration from old config files
sub read_raw_net_conf {
    my ($suffix) = @_;
    my $dir = "$::prefix/etc/sysconfig/network-scripts";
#    $suffix = $suffix ? ".$suffix" : '';
    rename "$dir/draknet$suffix", "$dir/drakconnect$suffix";
    getVarsFromSh("$dir/drakconnect_conf");
}

sub get_net_device {
    ${{ read_raw_net_conf() }}{InternetInterface};
}

sub read_net_conf {
    my ($_prefix, $netcnx, $netc) = @_;
    add2hash($netcnx, { read_raw_net_conf('_conf') });
    $netc->{$_} = $netcnx->{$_} foreach 'NET_DEVICE', 'NET_INTERFACE';
    $netcnx->{$netcnx->{type}} ||= {};
    add2hash($netcnx->{$netcnx->{type}}, { read_raw_net_conf($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;

=head1 network::netconnect::detect()

=head2 example of usage

use lib qw(/usr/lib/libDrakX);
use network::netconnect;
use Data::Dumper;

use class_discard;

local $in = class_discard->new;

network::netconnect::init_globals($in);
my %i;
&network::netconnect::detect(\%i);
print Dumper(\%i),"\n";

=cut
> #, c-format msgid "Please choose your keyboard layout" msgstr "" #: steps_interactive.pm:108 #, c-format msgid "Here is the full list of available keyboards:" msgstr "" #: steps_interactive.pm:146 #, c-format msgid "Install/Upgrade" msgstr "ትከል/አሳድግ" #: steps_interactive.pm:150 #, c-format msgid "Is this an install or an upgrade?" msgstr "" #: steps_interactive.pm:152 #, fuzzy, c-format msgid "" "_: This is a noun:\n" "Install" msgstr "ትከል" #: steps_interactive.pm:154 #, c-format msgid "Upgrade %s" msgstr "" #: steps_interactive.pm:172 #, c-format msgid "Encryption key for %s" msgstr "የ%s ሚስጢራዊ መገልበጫ ቁልፍ" #: steps_interactive.pm:205 #, c-format msgid "Cancel installation, reboot system" msgstr "" #: steps_interactive.pm:206 #, fuzzy, c-format msgid "New Installation" msgstr "በመትከል ላይ" #: steps_interactive.pm:207 #, c-format msgid "Upgrade previous installation (not recommended)" msgstr "" #: steps_interactive.pm:211 #, c-format msgid "" "Installer has detected that your installed Mageia system could not\n" "safely be upgraded to %s.\n" "\n" "New installation replacing your previous one is recommended.\n" "\n" "Warning : you should backup all your personal data before choosing \"New\n" "Installation\"." msgstr "" #: steps_interactive.pm:253 #, c-format msgid "IDE" msgstr "IDE" #: steps_interactive.pm:253 #, c-format msgid "Configuring IDE" msgstr "IDEን በማስተካከል ላይ" #: steps_interactive.pm:290 #, c-format msgid "" "No free space for 1MB bootstrap! Install will continue, but to boot your " "system, you'll need to create the bootstrap partition in DiskDrake" msgstr "" #: steps_interactive.pm:295 #, c-format msgid "" "You'll need to create a PPC PReP Boot bootstrap! Install will continue, but " "to boot your system, you'll need to create the bootstrap partition in " "DiskDrake" msgstr "" #: steps_interactive.pm:371 #, c-format msgid "" "Change your Cd-Rom!\n" "Please insert the Cd-Rom labelled \"%s\" in your drive and press Ok when " "done.\n" "If you do not have it, press Cancel to avoid installation from this Cd-Rom." msgstr "" #: steps_interactive.pm:388 #, c-format msgid "Looking for available packages..." msgstr "" #: steps_interactive.pm:396 #, c-format msgid "" "Your system does not have enough space left for installation or upgrade " "(%dMB > %dMB)" msgstr "" #: steps_interactive.pm:443 #, c-format msgid "" "Please choose load or save package selection.\n" "The format is the same as auto_install generated files." msgstr "" #: steps_interactive.pm:445 #, c-format msgid "Load" msgstr "ጫን" #: steps_interactive.pm:445 #, c-format msgid "Save" msgstr "አስቀምጥ" #: steps_interactive.pm:453 #, fuzzy, c-format msgid "Bad file" msgstr "1 ፋይል" #: steps_interactive.pm:469 #, fuzzy, c-format msgid "KDE" msgstr "IDE" #: steps_interactive.pm:470 #, c-format msgid "GNOME" msgstr "ኖም" #: steps_interactive.pm:473 #, fuzzy, c-format msgid "Desktop Selection" msgstr "የጥቅል ቡድን ምርጫ" #: steps_interactive.pm:474 #, c-format msgid "You can choose your workstation desktop profile." msgstr "" #: steps_interactive.pm:560 #, c-format msgid "Selected size is larger than available space" msgstr "" #: steps_interactive.pm:576 #, c-format msgid "Type of install" msgstr "የተከላው አይነት" #: steps_interactive.pm:577 #, c-format msgid "" "You have not selected any group of packages.\n" "Please choose the minimal installation you want:" msgstr "" #: steps_interactive.pm:582 #, c-format msgid "With X" msgstr "በX" #: steps_interactive.pm:583 #, fuzzy, c-format msgid "Install suggested packages" msgstr "የ%s ጥቅል በመትከል ላይ" #: steps_interactive.pm:584 #, c-format msgid "With basic documentation (recommended!)" msgstr "" #: steps_interactive.pm:585 #, c-format msgid "Truly minimal install (especially no urpmi)" msgstr "" #: steps_interactive.pm:641 #, c-format msgid "Preparing installation" msgstr "ተከላ በማዘጋጀት ላይ" #: steps_interactive.pm:649 #, c-format msgid "Installing package %s" msgstr "የ%s ጥቅል በመትከል ላይ" #: steps_interactive.pm:673 #, c-format msgid "There was an error ordering packages:" msgstr "" #: steps_interactive.pm:673 #, c-format msgid "Go on anyway?" msgstr "ለማንኛውም ቀጥል?" #: steps_interactive.pm:677 #, c-format msgid "Retry" msgstr "" #: steps_interactive.pm:678 #, c-format msgid "Skip this package" msgstr "" #: steps_interactive.pm:679 #, c-format msgid "Skip all packages from medium \"%s\"" msgstr "" #: steps_interactive.pm:680 #, fuzzy, c-format msgid "Go back to media and packages selection" msgstr "የጥቅሎችን ምርጫ አስቀምጥ" #: steps_interactive.pm:683 #, fuzzy, c-format msgid "There was an error installing package %s." msgstr "የ%s ጥቅል በመትከል ላይ" #: steps_interactive.pm:702 #, c-format msgid "Post-install configuration" msgstr "Post-install configuration" #: steps_interactive.pm:709 #, c-format msgid "Please ensure the Update Modules media is in drive %s" msgstr "" #: steps_interactive.pm:737 steps_list.pm:47 #, c-format msgid "Updates" msgstr "አሻሻዎች" #: steps_interactive.pm:738 #, c-format msgid "" "You now have the opportunity to download updated packages. These packages\n" "have been updated after the distribution was released. They may\n" "contain security or bug fixes.\n" "\n" "To download these packages, you will need to have a working Internet \n" "connection.\n" "\n" "Do you want to install the updates?" msgstr "" #: steps_interactive.pm:846 #, c-format msgid "%s on %s" msgstr "%s %s ላይ ነው" #: steps_interactive.pm:878 steps_interactive.pm:885 steps_interactive.pm:898 #: steps_interactive.pm:915 steps_interactive.pm:930 #, c-format msgid "Hardware" msgstr "ሀርድዌር" #: steps_interactive.pm:899 steps_interactive.pm:916 #, c-format msgid "Sound card" msgstr "የድምፅ ካርድ" #: steps_interactive.pm:919 #, c-format msgid "Do you have an ISA sound card?" msgstr "የISA ድምጽ ካርድ አለዎት?" #: steps_interactive.pm:921 #, c-format msgid "" "Run \"alsaconf\" or \"sndconfig\" after installation to configure your sound " "card" msgstr "" #: steps_interactive.pm:923 #, c-format msgid "No sound card detected. Try \"harddrake\" after installation" msgstr "" #: steps_interactive.pm:931 #, c-format msgid "Graphical interface" msgstr "ንድፋዊ እይታ" #: steps_interactive.pm:937 steps_interactive.pm:948 #, c-format msgid "Network & Internet" msgstr "መረብ እና ኢንተርኔት" #: steps_interactive.pm:949 #, c-format msgid "Proxies" msgstr "ወኪሎች" #: steps_interactive.pm:950 #, c-format msgid "configured" msgstr "ተስተካክሏል" #: steps_interactive.pm:960 #, c-format msgid "Security Level" msgstr "የደህንነት ደረጃ" #: steps_interactive.pm:979 #, c-format msgid "Firewall" msgstr "የእሳት ግድግዳ" #: steps_interactive.pm:983 #, c-format msgid "activated" msgstr "መስራት ጀምሯል" #: steps_interactive.pm:983 #, c-format msgid "disabled" msgstr "መስራት አቁሟል" #: steps_interactive.pm:997 #, c-format msgid "You have not configured X. Are you sure you really want this?" msgstr "" #: steps_interactive.pm:1026 #, c-format msgid "Preparing bootloader..." msgstr "አስጀማሪ በማዘጋጀት ላይ..." #: steps_interactive.pm:1027 #, c-format msgid "Be patient, this may take a while..." msgstr "" #: steps_interactive.pm:1038 #, c-format msgid "" "You appear to have an OldWorld or Unknown machine, the yaboot bootloader " "will not work for you. The install will continue, but you'll need to use " "BootX or some other means to boot your machine. The kernel argument for the " "root fs is: root=%s" msgstr "" #: steps_interactive.pm:1051 #, c-format msgid "" "In this security level, access to the files in the Windows partition is " "restricted to the administrator." msgstr "" #: steps_interactive.pm:1083 #, c-format msgid "Insert a blank floppy in drive %s" msgstr "" #: steps_interactive.pm:1085 #, c-format msgid "Creating auto install floppy..." msgstr "" #: steps_interactive.pm:1096 #, c-format msgid "" "Some steps are not completed.\n" "\n" "Do you really want to quit now?" msgstr "" #: steps_interactive.pm:1106 #, c-format msgid "Congratulations" msgstr "እንኳን ደስ ያለዎ!" #: steps_interactive.pm:1109 #, c-format msgid "Reboot" msgstr "እንደገና ጀምር" #. -PO: please keep the following messages very short: they must fit in the left list of the installer!!! #: steps_list.pm:16 #, c-format msgid "" "_: Keep these entry short\n" "Language" msgstr "ቋንቋ" #: steps_list.pm:16 steps_list.pm:23 #, c-format msgid "Localization" msgstr "" #: steps_list.pm:17 #, c-format msgid "" "_: Keep these entry short\n" "License" msgstr "" #: steps_list.pm:18 #, c-format msgid "" "_: Keep these entry short\n" "Mouse" msgstr "መጠቆሚያ" #: steps_list.pm:19 steps_list.pm:20 #, c-format msgid "" "_: Keep these entry short\n" "Hard disk drive detection" msgstr "" #: steps_list.pm:21 steps_list.pm:22 #, c-format msgid "" "_: Keep these entry short\n" "Installation class" msgstr "" #: steps_list.pm:23 #, c-format msgid "" "_: Keep these entry short\n" "Keyboard" msgstr "መተየቢያ" #: steps_list.pm:24 #, c-format msgid "" "_: Keep these entry short\n" "Security" msgstr "ደህንነት" #: steps_list.pm:25 #, c-format msgid "" "_: Keep these entry short\n" "Partitioning" msgstr "" #: steps_list.pm:27 steps_list.pm:28 #, c-format msgid "" "_: Keep these entry short\n" "Formatting" msgstr "" #: steps_list.pm:29 #, c-format msgid "" "_: Keep these entry short\n" "Choosing packages" msgstr "" #: steps_list.pm:31 #, c-format msgid "" "_: Keep these entry short\n" "Installing" msgstr "በመትከል ላይ" #: steps_list.pm:34 #, c-format msgid "" "_: Keep these entry short\n" "Users" msgstr "ተጠቃሚዎች" #: steps_list.pm:36 steps_list.pm:37 #, c-format msgid "" "_: Keep these entry short\n" "Networking" msgstr "መረብ" #: steps_list.pm:38 steps_list.pm:39 #, c-format msgid "" "_: Keep these entry short\n" "Bootloader" msgstr "አስጀማሪያ" #: steps_list.pm:40 steps_list.pm:41 #, c-format msgid "" "_: Keep these entry short\n" "Configure X" msgstr "Xን ሰይም" #: steps_list.pm:42 #, c-format msgid "" "_: Keep these entry short\n" "Summary" msgstr "ማጠቃለያ" #: steps_list.pm:44 steps_list.pm:45 #, c-format msgid "" "_: Keep these entry short\n" "Services" msgstr "አገልግሎት" #: steps_list.pm:46 #, c-format msgid "" "_: Keep these entry short\n" "Updates" msgstr "አሻሻዎች" #: steps_list.pm:48 #, c-format msgid "" "_: Keep these entry short\n" "Exit" msgstr "ውጣ" #, fuzzy #~ msgid "Downloading file %s..." #~ msgstr "የቅርብ ጊዜ ፋይሎች" #, fuzzy #~ msgid "IceWm Desktop" #~ msgstr "ሰሌዳ" #~ msgid "Unable to contact mirror %s" #~ msgstr "ከአንጸባራቂ %s ጋር መገናኘት አልተቻለም" #~ msgid "Save packages selection" #~ msgstr "የጥቅሎችን ምርጫ አስቀምጥ" #, fuzzy #~ msgid "Do you want to use aboot?" #~ msgstr "ስራ-እቅዱን መሠረዝ ይፈልጋሉ?" #~ msgid "All" #~ msgstr "ሁሉንም" #~ msgid "TV card" #~ msgstr "የቲቪ ካርድ" #~ msgid "Boot" #~ msgstr "ጀምር" #~ msgid "Gwenview" #~ msgstr "Gwenview" #, fuzzy #~ msgid "(%d package, %d MB)" #~ msgid_plural "(%d packages, %d MB)" #~ msgstr[0] "%d ጥቅሎች" #~ msgstr[1] "%d ጥቅሎች" #~ msgid "%d packages" #~ msgstr "%d ጥቅሎች" #~ msgid "Language" #~ msgstr "ቋንቋ" #, fuzzy #~ msgid "Installation class" #~ msgstr "በመትከል ላይ" #, fuzzy #~ msgid "Formatting" #~ msgstr "በግምት" #, fuzzy #~ msgid "Choosing packages" #~ msgstr "%d ጥቅሎች" #~ msgid "Users" #~ msgstr "ተጠቃሚዎች" #~ msgid "Networking" #~ msgstr "መረብ" #~ msgid "Configure X" #~ msgstr "Xን ሰይም"