diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2002-12-29 11:50:19 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2002-12-29 11:50:19 +0000 |
commit | 838b9f0b8668a4c81c39c9ea9f777952f1b46a0a (patch) | |
tree | 6901501a44ee8e4e9fe03f106b3c7d2f8a7e40a4 /perl-install/network/network.pm | |
parent | 4f39c8ec7dc57153ff67d77c8e497c5effa63770 (diff) | |
download | drakx-backup-do-not-use-838b9f0b8668a4c81c39c9ea9f777952f1b46a0a.tar drakx-backup-do-not-use-838b9f0b8668a4c81c39c9ea9f777952f1b46a0a.tar.gz drakx-backup-do-not-use-838b9f0b8668a4c81c39c9ea9f777952f1b46a0a.tar.bz2 drakx-backup-do-not-use-838b9f0b8668a4c81c39c9ea9f777952f1b46a0a.tar.xz drakx-backup-do-not-use-838b9f0b8668a4c81c39c9ea9f777952f1b46a0a.zip |
- move any::pppConfig() to network::modem::ppp_configure()
- move any::miscellaneousNetwork() to network::network::proxy_configure()
(and uses the parameter instead of $::o->{miscellaneous})
- move network::network::miscellaneousNetwork() to network::network::miscellaneous_choose()
(and do not export it)
(and uses a parameter instead of $::o->{miscellaneous})
- move network::modem::pppConfig() to network::modem::ppp_choose()
(and change parameter order, and drop unused parameter $intf)
- do not export network::network::write_interface_conf()
(since it is only used locally (?))
- cleanup network::network::write_interface_conf()
(one still needs to pass $::o->{miscellaneous}{track_network_id} more
cleanly, and use run_program::rooted when calling /sbin/ip)
Diffstat (limited to 'perl-install/network/network.pm')
-rw-r--r-- | perl-install/network/network.pm | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index 12085f636..888630b3d 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -13,7 +13,7 @@ use log; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); -@EXPORT = qw(resolv configureNetworkIntf netmask dns is_ip masked_ip findIntf addDefaultRoute write_interface_conf read_all_conf dnsServers guessHostname configureNetworkNet read_resolv_conf read_interface_conf add2hosts gateway configureNetwork2 write_conf sethostname miscellaneousNetwork down_it read_conf write_resolv_conf up_it); +@EXPORT = qw(resolv configureNetworkIntf netmask dns is_ip masked_ip findIntf addDefaultRoute read_all_conf dnsServers guessHostname configureNetworkNet read_resolv_conf read_interface_conf add2hosts gateway configureNetwork2 write_conf sethostname down_it read_conf write_resolv_conf up_it); #-###################################################################################### #- Functions @@ -121,17 +121,20 @@ sub write_resolv_conf { sub write_interface_conf { my ($file, $intf, $prefix) = @_; + if ($::o->{miscellaneous}{track_network_id} && -e "$prefix/sbin/ip") { + $intf->{HWADDR} = undef; + if (my $s = `LC_ALL= LANG= $prefix/sbin/ip -o link show $intf->{DEVICE} 2>/dev/null`) { + if ($s =~ m|.*link/ether\s([0-9a-z:]+)\s|) { + $intf->{HWADDR} = $1; + } + } + } 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), if_($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))); } @@ -372,12 +375,13 @@ You may also enter the IP address of the gateway if you have one"), ); } -sub miscellaneousNetwork { - my ($in, $clicked, $no_track_net) = @_; - my $u = $::o->{miscellaneous} ||= {}; - $::isInstall and $in->set_help('configureNetworkProxy'); +sub miscellaneous_choose { + my ($in, $u, $clicked, $no_track_net) = @_; + $in->set_help('configureNetworkProxy') if $::isInstall; + $u->{track_network_id} = detect_devices::isLaptop(); - $::expert || $clicked and ($in->ask_from('', + + $in->ask_from('', N("Proxies configuration"), [ { label => N("HTTP proxy"), val => \$u->{http_proxy} }, { label => N("FTP proxy"), val => \$u->{ftp_proxy} }, @@ -388,10 +392,16 @@ sub miscellaneousNetwork { $u->{ftp_proxy} =~ m,^($|ftp://|http://), or $in->ask_warn('', N("Url should begin with 'ftp:' or 'http:'")), return 1,1; 0; } - ) or return); + ) or return if $::expert || $clicked; 1; } +sub proxy_configure { + my ($u) = @_; + setExportedVarsInSh( "$::prefix/etc/profile.d/proxy.sh", $u, qw(http_proxy ftp_proxy)); + setExportedVarsInCsh("$::prefix/etc/profile.d/proxy.csh", $u, qw(http_proxy ftp_proxy)); +} + sub read_all_conf { my ($prefix, $netc, $intf) = @_; $netc ||= {}; $intf ||= {}; @@ -447,7 +457,7 @@ sub configureNetwork2 { } #-res_init(); #- reinit the resolver so DNS changes take affect - any::miscellaneousNetwork(); + proxy_configure($::o->{miscellaneous}); } |