summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/any.pm4
-rw-r--r--perl-install/network/netconnect.pm38
-rw-r--r--perl-install/network/network.pm43
-rw-r--r--perl-install/standalone/net_applet8
4 files changed, 48 insertions, 45 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 9b99b5ba2..085b3abe7 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -353,7 +353,7 @@ sub setupBootloader__entries {
require Xconfig::resolution_and_depth;
my $Modify = sub {
- require network::netconnect; #- to list network profiles
+ require network::network; #- to list network profiles
my ($e) = @_;
my $default = my $old_default = $e->{label} eq $b->{default};
my $vga = Xconfig::resolution_and_depth::from_bios($e->{vga});
@@ -369,7 +369,7 @@ sub setupBootloader__entries {
{ label => N("Video mode"), val => \$vga, list => [ '', Xconfig::resolution_and_depth::bios_vga_modes() ], format => \&Xconfig::resolution_and_depth::to_string, advanced => 1 },
),
{ label => N("Initrd"), val => \$e->{initrd}, list => [ map { if_(/^initrd/, "/boot/$_") } all("$::prefix/boot") ], not_edit => 0, advanced => 1 },
-{ label => N("Network profile"), val => \$netprofile, list => [ sort(uniq('', $netprofile, network::netconnect::get_profiles())) ], advanced => 1 },
+{ label => N("Network profile"), val => \$netprofile, list => [ sort(uniq('', $netprofile, network::network::netprofile_list())) ], advanced => 1 },
);
} else {
@l = (
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});
}
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet
index 8f81d72b5..53c42f62c 100644
--- a/perl-install/standalone/net_applet
+++ b/perl-install/standalone/net_applet
@@ -81,11 +81,11 @@ my %actions = (
},
'chooseProfile' => {
name => N("Profiles"),
- choices => sub { network::netconnect::get_profiles() },
- choice_selected => sub { $_[0] eq $netcnx->{PROFILE} },
+ choices => sub { network::network::netprofile_list()) },
+ choice_selected => sub { $_[0] eq $netc->{PROFILE} },
launch => sub {
- $netcnx->{PROFILE} = $_[0];
- network::tools::bg_command_as_root('/sbin/set-netprofile', $netcnx->{PROFILE});
+ $netc->{PROFILE} = $_[0];
+ network::tools::bg_command_as_root('/sbin/set-netprofile', $netc->{PROFILE});
}
},
'refresh' => { name => N("Refresh"), launch => sub { checkNetworkForce() } },