summaryrefslogtreecommitdiffstats
path: root/perl-install/network/network.pm
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/network.pm
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/network.pm')
-rw-r--r--perl-install/network/network.pm43
1 files changed, 42 insertions, 1 deletions
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});
}