summaryrefslogtreecommitdiffstats
path: root/perl-install/network
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2005-05-30 11:00:55 +0000
committerOlivier Blin <oblin@mandriva.org>2005-05-30 11:00:55 +0000
commit4b4f9f315bc66a6ba4db04e8cdebcccee398f40b (patch)
tree6e2eff960a52df1081dab419e59565ecbb53c80d /perl-install/network
parenta89672a52248dd56ae1f1ba691a1e476820644a6 (diff)
downloaddrakx-4b4f9f315bc66a6ba4db04e8cdebcccee398f40b.tar
drakx-4b4f9f315bc66a6ba4db04e8cdebcccee398f40b.tar.gz
drakx-4b4f9f315bc66a6ba4db04e8cdebcccee398f40b.tar.bz2
drakx-4b4f9f315bc66a6ba4db04e8cdebcccee398f40b.tar.xz
drakx-4b4f9f315bc66a6ba4db04e8cdebcccee398f40b.zip
move netprofile stuff in network::network
Diffstat (limited to 'perl-install/network')
-rw-r--r--perl-install/network/netconnect.pm38
-rw-r--r--perl-install/network/network.pm43
2 files changed, 42 insertions, 39 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm
index c2c87866f..58f1d502f 100644
--- a/perl-install/network/netconnect.pm
+++ b/perl-install/network/netconnect.pm
@@ -1524,47 +1524,9 @@ sub main {
}
}
-sub set_profile {
- my ($netcnx) = @_;
- system('/sbin/set-netprofile', $netcnx->{PROFILE});
- log::explanations(qq(Switching to "$netcnx->{PROFILE}" profile));
-}
-
-sub save_profile {
- my ($netcnx) = @_;
- system('/sbin/save-netprofile', $netcnx->{PROFILE});
- log::explanations(qq(Saving "$netcnx->{PROFILE}" profile));
-}
-
-sub del_profile {
- my ($profile) = @_;
- return if !$profile || $profile eq "default";
- rm_rf("$::prefix/etc/netprofile/profiles/$profile");
- log::explanations(qq(Deleting "$profile" profile));
-}
-
-sub add_profile {
- my ($netcnx, $profile) = @_;
- return if !$profile || $profile eq "default" || member($profile, get_profiles());
- system('/sbin/clone-netprofile', $netcnx->{PROFILE}, $profile);
- log::explanations(qq("Creating "$profile" profile));
-}
-
-sub get_profiles() {
- map { if_(m!([^/]*)/$!, $1) } glob("$::prefix/etc/netprofile/profiles/*/");
-}
-
sub read_net_conf {
my ($netcnx, $netc, $intf) = @_;
- my $current = { getVarsFromSh("$::prefix/etc/netprofile/current") };
-
- $netcnx->{PROFILE} = $current->{PROFILE} || 'default';
network::network::read_all_conf($::prefix, $netc, $intf, $netcnx);
-
- foreach ('NET_DEVICE', 'NET_INTERFACE') {
- $netc->{$_} = $netcnx->{$_} if $netcnx->{$_};
- }
- $netcnx->{$netcnx->{type}} ||= {} if $netcnx->{type};
}
sub start_internet {
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm
index 5f90dcdaa..2bccad7df 100644
--- a/perl-install/network/network.pm
+++ b/perl-install/network/network.pm
@@ -140,7 +140,7 @@ sub write_interface_conf {
defined($intf->{METRIC}) or $intf->{METRIC} = network::tools::get_default_metric(network::tools::get_interface_type($intf)),
$intf->{BOOTPROTO} =~ s/dhcp.*/dhcp/;
- setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR METRIC MII_NOT_SUPPORTED TYPE USERCTL ATM_ADDR),
+ setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR METRIC MII_NOT_SUPPORTED TYPE USERCTL ATM_ADDR ETHTOOL_OPTS),
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 WIRELESS_WPA_DRIVER),
qw(DVB_ADAPTER_ID DVB_NETWORK_DEMUX DVB_NETWORK_PID),
if_($intf->{BOOTPROTO} eq "dhcp", qw(DHCP_CLIENT DHCP_HOSTNAME NEEDHOSTNAME PEERDNS PEERYP PEERNTPD DHCP_TIMEOUT)),
@@ -291,6 +291,45 @@ sub gateway {
join(".", @masked);
}
+
+sub netprofile_set {
+ my ($netc, $profile) = @_;
+ $netc->{PROFILE} = $profile;
+ system('/sbin/set-netprofile', $netc->{PROFILE});
+ log::explanations(qq(Switching to "$netc->{PROFILE}" profile));
+}
+
+sub netprofile_save {
+ my ($netc) = @_;
+ system('/sbin/save-netprofile', $netc->{PROFILE});
+ log::explanations(qq(Saving "$netc->{PROFILE}" profile));
+}
+
+sub netprofile_delete {
+ my ($profile) = @_;
+ return if !$profile || $profile eq "default";
+ rm_rf("$::prefix/etc/netprofile/profiles/$profile");
+ log::explanations(qq(Deleting "$profile" profile));
+}
+
+sub netprofile_add {
+ my ($netc, $profile) = @_;
+ return if !$profile || $profile eq "default" || member($profile, netprofile_list());
+ system('/sbin/clone-netprofile', $netc->{PROFILE}, $profile);
+ log::explanations(qq("Creating "$profile" profile));
+}
+
+sub netprofile_list() {
+ map { if_(m!([^/]*)/$!, $1) } glob("$::prefix/etc/netprofile/profiles/*/");
+}
+
+sub netprofile_read {
+ my ($netc) = @_;
+ my $config = { getVarsFromSh("$::prefix/etc/netprofile/current") };
+ $netc->{PROFILE} = $config->{PROFILE} || 'default';
+}
+
+
sub miscellaneous_choose {
my ($in, $u) = @_;
@@ -398,6 +437,7 @@ sub read_all_conf {
add2hash($netc, read_conf("$::prefix/etc/sysconfig/network")) if -r "$::prefix/etc/sysconfig/network";
add2hash($netc, read_resolv_conf());
add2hash($netc, read_tmdns_conf());
+
foreach (all("$::prefix/etc/sysconfig/network-scripts")) {
my ($device) = /^ifcfg-([A-Za-z0-9.:_-]+)$/;
next if $device =~ /.rpmnew$|.rpmsave$/;
@@ -407,6 +447,7 @@ sub read_all_conf {
$intf->{DEVICE} ||= $device;
}
}
+ netprofile_read($netc);
if (my $default_intf = network::tools::get_default_gateway_interface($netc, $intf)) {
$netcnx->{type} ||= network::tools::get_interface_type($intf->{$default_intf});
}